@@ -335,30 +335,6 @@ def _safe_import_hook(self, name, caller, fromlist, level=-1):
335335 fullname = name + "." + sub
336336 self ._add_badmodule (fullname , caller )
337337
338- def scan_opcodes (self , co ,
339- unpack = struct .unpack ):
340- # Scan the code, and yield 'interesting' opcode combinations
341- # Version for Python 2.4 and older
342- code = co .co_code
343- names = co .co_names
344- consts = co .co_consts
345- while code :
346- c = code [0 ]
347- if c in STORE_OPS :
348- oparg , = unpack ('<H' , code [1 :3 ])
349- yield "store" , (names [oparg ],)
350- code = code [3 :]
351- continue
352- if c == LOAD_CONST and code [3 ] == IMPORT_NAME :
353- oparg_1 , oparg_2 = unpack ('<xHxH' , code [:6 ])
354- yield "import" , (consts [oparg_1 ], names [oparg_2 ])
355- code = code [6 :]
356- continue
357- if c >= HAVE_ARGUMENT :
358- code = code [3 :]
359- else :
360- code = code [1 :]
361-
362338 def scan_opcodes_25 (self , co ,
363339 unpack = struct .unpack ):
364340 # Scan the code, and yield 'interesting' opcode combinations
@@ -390,10 +366,7 @@ def scan_opcodes_25(self, co,
390366
391367 def scan_code (self , co , m ):
392368 code = co .co_code
393- if sys .version_info >= (2 , 5 ):
394- scanner = self .scan_opcodes_25
395- else :
396- scanner = self .scan_opcodes
369+ scanner = self .scan_opcodes_25
397370 for what , args in scanner (co ):
398371 if what == "store" :
399372 name , = args
0 commit comments