@@ -222,9 +222,6 @@ def load_module_from_file_object(
222222 # FIXME: use the internal routine below
223223 tuple_version = magic_int2tuple (magic_int )
224224 except KeyError :
225- if magic_int in (2657 , 22138 ):
226- raise ImportError ("This smells like Pyston which is not supported." )
227-
228225 if len (magic ) >= 2 :
229226 raise ImportError (
230227 "Unknown magic number %s in %s"
@@ -233,6 +230,10 @@ def load_module_from_file_object(
233230 else :
234231 raise ImportError (f"Bad magic number: '{ magic } '" )
235232
233+ if magic_int in (2657 , 22138 ):
234+ version = magicint2version .get (magic_int , "" )
235+ raise ImportError (f"Magic int { magic_int } ({ version } ) is not supported." )
236+
236237 if magic_int in (
237238 3010 ,
238239 3020 ,
@@ -300,7 +301,11 @@ def load_module_from_file_object(
300301 source_size = unpack ("<I" , fp .read (4 ))[0 ] # size mod 2**32
301302 pass
302303 else :
303- timestamp = unpack ("<I" , ts )[0 ]
304+
305+ # Early Pyston targeting 2.7 doesn't seem to have a timestamp!
306+ if magic_int not in (2657 ,):
307+ timestamp = unpack ("<I" , ts )[0 ]
308+
304309 # Note: a higher magic number doesn't necessarily mean a later
305310 # release. At Python 3.0 the magic number decreased
306311 # significantly. Hence, the range below. Also note inclusion of
@@ -310,7 +315,7 @@ def load_module_from_file_object(
310315 if (
311316 (3200 <= magic_int < 20121 )
312317 and version >= (1 , 5 )
313- or magic_int in PYPY3_MAGICS
318+ or magic_int in list ( PYPY3_MAGICS ) + [ 2657 ]
314319 ):
315320 source_size = unpack ("<I" , fp .read (4 ))[0 ] # size mod 2**32
316321
0 commit comments