From 97cb19a8a2ab5b309357f03f55acf5933322068a Mon Sep 17 00:00:00 2001 From: Simon Gomizelj Date: Mon, 12 Mar 2018 01:25:30 -0400 Subject: [PATCH] Fix bytecode loading on Python 3.7 --- hy/importer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hy/importer.py b/hy/importer.py index 1b368a8..1fd8c6d 100644 --- a/hy/importer.py +++ b/hy/importer.py @@ -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 # that compiled this bytecode. 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, # are the mtime of the corresponding source file. bytecode_mtime, = struct.unpack('