Fix bytecode loading on Python 3.7
This commit is contained in:
parent
03eab21fbf
commit
97cb19a8a2
@ -77,6 +77,9 @@ def import_file_to_module(module_name, fpath, loader=None):
|
|||||||
# The first 4 bytes are the magic number for the version of Python
|
# The first 4 bytes are the magic number for the version of Python
|
||||||
# that compiled this bytecode.
|
# that compiled this bytecode.
|
||||||
bytecode_magic = bc_f.read(4)
|
bytecode_magic = bc_f.read(4)
|
||||||
|
# Python 3.7 introduced a new flags entry in the header structure.
|
||||||
|
if PY37:
|
||||||
|
bc_f.read(4)
|
||||||
# The next 4 bytes, interpreted as a little-endian 32-bit integer,
|
# The next 4 bytes, interpreted as a little-endian 32-bit integer,
|
||||||
# are the mtime of the corresponding source file.
|
# are the mtime of the corresponding source file.
|
||||||
bytecode_mtime, = struct.unpack('<i', bc_f.read(4))
|
bytecode_mtime, = struct.unpack('<i', bc_f.read(4))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user