mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #11235: Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp.
This commit is contained in:
parent
7fa5a99b06
commit
2be60afb7e
4 changed files with 36 additions and 7 deletions
|
@ -310,6 +310,18 @@ class ImportTests(unittest.TestCase):
|
|||
"""))
|
||||
script_helper.assert_python_ok(testfn)
|
||||
|
||||
def test_timestamp_overflow(self):
|
||||
# A modification timestamp larger than 2**32 should not be a problem
|
||||
# when importing a module (issue #11235).
|
||||
source = TESTFN + ".py"
|
||||
compiled = imp.cache_from_source(source)
|
||||
with open(source, 'w') as f:
|
||||
pass
|
||||
os.utime(source, (2 ** 33, 2 ** 33))
|
||||
__import__(TESTFN)
|
||||
# The pyc file was created.
|
||||
os.stat(compiled)
|
||||
|
||||
|
||||
class PycRewritingTests(unittest.TestCase):
|
||||
# Test that the `co_filename` attribute on code objects always points
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue