@@ -71,6 +71,7 @@ def __init__(self, python_version, is_pypy) -> None:
7171 self .size = 0 # Size of source code. Only relevant in version 3 and above
7272 self .is_pypy = is_pypy
7373 self .python_version = python_version
74+ self .is_pypy = is_pypy
7475 self .timestamp = None
7576 self .backpatch = [] # list of backpatch dicts, one for each function
7677 self .label = [] # list of label dists, one for each function
@@ -170,11 +171,11 @@ def asm_file(path) -> Optional[Assembler]:
170171 # FIXME: extract all code options below the top-level and asm.code_list
171172
172173 elif line .startswith ("#" ):
173- match = re .match ("^# (Pypy )?Python bytecode " , line )
174+ match = re .match ("^# (PyPy )?Python bytecode " , line )
174175 if match :
175176 if match .group (1 ):
177+ is_pypy = True
176178 pypy_str = match .group (1 )
177- is_pypy = len (pypy_str )
178179 else :
179180 is_pypy = False
180181 pypy_str = ""
@@ -197,7 +198,7 @@ def asm_file(path) -> Optional[Assembler]:
197198 elif line .startswith ("# Timestamp in code: " ):
198199 text = line [len ("# Timestamp in code: " ) :].strip ()
199200 time_str = text .split ()[0 ]
200- if is_int (time_str ):
201+ if is_int (time_str ) and hasattr ( asm , "timestamp" ) :
201202 asm .timestamp = int (time_str )
202203 elif line .startswith ("# Method Name: " ):
203204 if method_name :
@@ -248,7 +249,9 @@ def asm_file(path) -> Optional[Assembler]:
248249 elif line .startswith ("# Number of locals: " ):
249250 l_str = line [len ("# Number of locals: " ) :].strip ()
250251 asm .code .co_nlocals = int (l_str )
251- elif line .startswith ("# Source code size mod 2**32: " ):
252+ elif line .startswith ("# Source code size mod 2**32: " ) and hasattr (
253+ asm , "size"
254+ ):
252255 l_str = line [
253256 len ("# Source code size mod 2**32: " ) : - len (" bytes" )
254257 ].strip ()
0 commit comments