Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address Serhiy's comments
  • Loading branch information
ammaraskar committed Apr 30, 2020
commit 1071bf522107447caedc4ecd23f2613f7cab65e2
12 changes: 8 additions & 4 deletions Lib/test/test_compileall.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@ def timestamp_metadata(self):
def test_year_2038_mtime_compilation(self):
# Test to make sure we can handle mtimes larger than what a 32-bit
# signed number can hold as part of bpo-34990
with open(self.source_path, 'r') as f:
os.utime(f.name, (2**32 - 1, 2**32 - 1))
os.utime(self.source_path, (2**32 - 1, 2**32 - 1))
Comment thread
ammaraskar marked this conversation as resolved.
Outdated
self.assertTrue(compileall.compile_file(self.source_path))

with open(self.source_path, 'r') as f:
os.utime(f.name, (2**35, 2**35))
def test_larger_than_32_bit_times(self):
# This is similar to the test above but we skip it if the OS doesn't
# support modification times larger than 32-bits.
try:
os.utime(self.source_path, (2**35, 2**35))
except (OverflowError, OSError):
self.skipTest("filesystem doesn't support large timestamps")
self.assertTrue(compileall.compile_file(self.source_path))

def recreation_check(self, metadata):
Expand Down
11 changes: 0 additions & 11 deletions Lib/test/test_zipimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ def get_file():

def make_pyc(co, mtime, size):
data = marshal.dumps(co)
if type(mtime) is type(0.0):
# Mac mtimes need a bit of special casing
if mtime < 0x7fffffff:
mtime = int(mtime)
else:
mtime = int(-0x100000000 + int(mtime))
pyc = (importlib.util.MAGIC_NUMBER +
struct.pack("<iLL", 0,
Comment thread
serhiy-storchaka marked this conversation as resolved.
int(mtime) & 0xFFFF_FFFF, size & 0xFFFF_FFFF) + data)
Expand Down Expand Up @@ -262,11 +256,6 @@ def test2038MTime(self):
TESTMOD + pyc_ext: (NOW, twenty_thirty_eight_pyc)}
self.doTest(".py", files, TESTMOD)

larger_than_32_bit = make_pyc(test_co, 2**35, len(test_src))
files = {TESTMOD + ".py": (NOW, test_src),
TESTMOD + pyc_ext: (NOW, twenty_thirty_eight_pyc)}
self.doTest(".py", files, TESTMOD)

def testPackage(self):
packdir = TESTPACK + os.sep
files = {packdir + "__init__" + pyc_ext: (NOW, test_pyc),
Expand Down