summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_import.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-01-24 16:45:50 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-01-24 16:45:50 (GMT)
commitabaf89b2be32db1deae32cbdf0645a4be65c6297 (patch)
tree966393e84f1693146f2dd81d2fbe111911ea3d10 /Lib/test/test_import.py
parenta10999d55c93aa7bccc2b87ca81a336b20459bcd (diff)
parent2be60afb7e0753c1bd5c297960cf8686a1ec7e1e (diff)
downloadcpython-abaf89b2be32db1deae32cbdf0645a4be65c6297.zip
cpython-abaf89b2be32db1deae32cbdf0645a4be65c6297.tar.gz
cpython-abaf89b2be32db1deae32cbdf0645a4be65c6297.tar.bz2
Issue #11235: Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp.
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r--Lib/test/test_import.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index e4d5332..70787a4 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -306,6 +306,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