Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
33d15f7c
Commit
33d15f7c
authored
Jan 25, 2012
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port import fixes from 2.7.
parent
dd21f689
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
12 deletions
+12
-12
Lib/importlib/test/source/test_file_loader.py
Lib/importlib/test/source/test_file_loader.py
+1
-1
Lib/test/test_import.py
Lib/test/test_import.py
+1
-1
Python/import.c
Python/import.c
+10
-10
No files found.
Lib/importlib/test/source/test_file_loader.py
View file @
33d15f7c
...
...
@@ -138,7 +138,7 @@ class SimpleTest(unittest.TestCase):
with
open
(
source
,
'w'
)
as
f
:
f
.
write
(
"x = 5"
)
try
:
os
.
utime
(
source
,
(
2
**
33
,
2
**
33
))
os
.
utime
(
source
,
(
2
**
33
-
5
,
2
**
33
-
5
))
except
OverflowError
:
self
.
skipTest
(
"cannot set modification time to large integer"
)
except
OSError
as
e
:
...
...
Lib/test/test_import.py
View file @
33d15f7c
...
...
@@ -321,7 +321,7 @@ class ImportTests(unittest.TestCase):
with
open
(
source
,
'w'
)
as
f
:
pass
try
:
os
.
utime
(
source
,
(
2
**
33
,
2
**
33
))
os
.
utime
(
source
,
(
2
**
33
-
5
,
2
**
33
-
5
))
except
OverflowError
:
self
.
skipTest
(
"cannot set modification time to large integer"
)
except
OSError
as
e
:
...
...
Python/import.c
View file @
33d15f7c
...
...
@@ -1226,9 +1226,9 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
(
void
)
unlink
(
cpathname
);
return
;
}
/* Now write the true mtime */
/* Now write the true mtime
(as a 32-bit field)
*/
fseek
(
fp
,
4L
,
0
);
assert
(
mtime
<
LONG_MAX
);
assert
(
mtime
<
=
0xFFFFFFFF
);
PyMarshal_WriteLongToFile
((
long
)
mtime
,
fp
,
Py_MARSHAL_VERSION
);
fflush
(
fp
);
fclose
(
fp
);
...
...
@@ -1302,14 +1302,14 @@ load_source_module(char *name, char *pathname, FILE *fp)
pathname
);
return
NULL
;
}
#if SIZEOF_TIME_T > 4
/* Python's .pyc timestamp handling presumes that the timestamp fits
in 4 bytes. Since the code only does an equality comparison,
ordering is not important and we can safely ignore the higher bits
(collisions are extremely unlikely).
*/
st
.
st_mtime
&=
0xFFFFFFFF
;
#endif
if
(
sizeof
st
.
st_mtime
>
4
)
{
/* Python's .pyc timestamp handling presumes that the timestamp fits
in 4 bytes. Since the code only does an equality comparison,
ordering is not important and we can safely ignore the higher bits
(collisions are extremely unlikely).
*/
st
.
st_mtime
&=
0xFFFFFFFF
;
}
cpathname
=
make_compiled_pathname
(
pathname
,
buf
,
(
size_t
)
MAXPATHLEN
+
1
,
!
Py_OptimizeFlag
);
if
(
cpathname
!=
NULL
&&
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment