summaryrefslogtreecommitdiff
path: root/Lib/modulefinder.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/modulefinder.py')
-rw-r--r--Lib/modulefinder.py29
1 files changed, 1 insertions, 28 deletions
diff --git a/Lib/modulefinder.py b/Lib/modulefinder.py
index ebd068aaa2..b19941e61e 100644
--- a/Lib/modulefinder.py
+++ b/Lib/modulefinder.py
@@ -335,30 +335,6 @@ class ModuleFinder:
fullname = name + "." + sub
self._add_badmodule(fullname, caller)
- def scan_opcodes(self, co,
- unpack = struct.unpack):
- # Scan the code, and yield 'interesting' opcode combinations
- # Version for Python 2.4 and older
- code = co.co_code
- names = co.co_names
- consts = co.co_consts
- while code:
- c = code[0]
- if c in STORE_OPS:
- oparg, = unpack('<H', code[1:3])
- yield "store", (names[oparg],)
- code = code[3:]
- continue
- if c == LOAD_CONST and code[3] == IMPORT_NAME:
- oparg_1, oparg_2 = unpack('<xHxH', code[:6])
- yield "import", (consts[oparg_1], names[oparg_2])
- code = code[6:]
- continue
- if c >= HAVE_ARGUMENT:
- code = code[3:]
- else:
- code = code[1:]
-
def scan_opcodes_25(self, co,
unpack = struct.unpack):
# Scan the code, and yield 'interesting' opcode combinations
@@ -390,10 +366,7 @@ class ModuleFinder:
def scan_code(self, co, m):
code = co.co_code
- if sys.version_info >= (2, 5):
- scanner = self.scan_opcodes_25
- else:
- scanner = self.scan_opcodes
+ scanner = self.scan_opcodes_25
for what, args in scanner(co):
if what == "store":
name, = args