Skip to content
Closed
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
Use unsigned long for the header size
  • Loading branch information
matrixise committed Oct 17, 2018
commit b7e89cc9293fd10049e7bdb8cdb17a7556719384
2 changes: 1 addition & 1 deletion Lib/compileall.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def compile_file(fullname, ddir=None, force=False, rx=None, quiet=0,
if not force:
try:
mtime = int(os.stat(fullname).st_mtime)
expect = struct.pack('<4slL', importlib.util.MAGIC_NUMBER,
expect = struct.pack('<4sLL', importlib.util.MAGIC_NUMBER,
0, mtime)
Comment thread
vstinner marked this conversation as resolved.
with open(cfile, 'rb') as chandle:
actual = chandle.read(12)
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_compileall.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def timestamp_metadata(self):
with open(self.bc_path, 'rb') as file:
data = file.read(12)
mtime = int(os.stat(self.source_path).st_mtime)
compare = struct.pack('<4slL', importlib.util.MAGIC_NUMBER, 0, mtime)
compare = struct.pack('<4sLL', importlib.util.MAGIC_NUMBER, 0, mtime)
return data, compare

@unittest.skipUnless(hasattr(os, 'stat'), 'test needs os.stat()')
Expand All @@ -76,7 +76,7 @@ def recreation_check(self, metadata):

def test_mtime(self):
# Test a change in mtime leads to a new .pyc.
self.recreation_check(struct.pack('<4slL', importlib.util.MAGIC_NUMBER,
self.recreation_check(struct.pack('<4sLL', importlib.util.MAGIC_NUMBER,
0, 1))

def test_magic_number(self):
Expand Down