|
1 | 1 |
|
2 | 2 | # from .mf.mf_next import * # for debugging next version |
3 | 3 | from modulefinder import ( |
4 | | - # STORE_OPS, |
5 | | - # LOAD_CONST, |
6 | | - # IMPORT_NAME, |
7 | 4 | ModuleFinder as NativeModuleFinder |
8 | 5 | ) |
9 | | -# import struct |
10 | | -import imp |
| 6 | +import warnings |
| 7 | +with warnings.catch_warnings(): |
| 8 | + warnings.simplefilter('ignore', PendingDeprecationWarning) |
| 9 | + import imp |
11 | 10 | import marshal |
12 | 11 | import dis |
13 | | -# import sys |
| 12 | + |
14 | 13 | HAVE_ARGUMENT = dis.HAVE_ARGUMENT |
15 | 14 |
|
16 | 15 |
|
@@ -77,61 +76,6 @@ def load_module(self, fqname, fp, pathname, file_info): |
77 | 76 | self.msgout(2, "load_module ->", m) |
78 | 77 | return m |
79 | 78 |
|
80 | | - # def scan_opcodes_24(self, co, |
81 | | - # unpack=struct.unpack): # pragma: nocover |
82 | | - # # Scan the code, and yield 'interesting' opcode combinations |
83 | | - # # Version for Python 2.4 and older |
84 | | - # code = co.co_code |
85 | | - # names = co.co_names |
86 | | - # consts = co.co_consts |
87 | | - # while code: |
88 | | - # c = code[0] |
89 | | - # if c in STORE_OPS: |
90 | | - # oparg, = unpack('<H', code[1:3]) |
91 | | - # yield "store", (names[oparg],) |
92 | | - # code = code[3:] |
93 | | - # continue |
94 | | - # if c == LOAD_CONST and code[3] == IMPORT_NAME: |
95 | | - # oparg_1, oparg_2 = unpack('<xHxH', code[:6]) |
96 | | - # yield "import", (consts[oparg_1], names[oparg_2]) |
97 | | - # code = code[6:] |
98 | | - # continue |
99 | | - # if c >= HAVE_ARGUMENT: |
100 | | - # code = code[3:] |
101 | | - # else: |
102 | | - # code = code[1:] |
103 | | - |
104 | | - # def scan_opcodes_25(self, co, |
105 | | - # unpack = struct.unpack): |
106 | | - # # Scan the code, and yield 'interesting' opcode combinations |
107 | | - # # Python 2.5 version (has absolute and relative imports) |
108 | | - # code = co.co_code |
109 | | - # names = co.co_names |
110 | | - # consts = co.co_consts |
111 | | - # LOAD_LOAD_AND_IMPORT = LOAD_CONST + LOAD_CONST + IMPORT_NAME |
112 | | - # while code: |
113 | | - # c = code[0] |
114 | | - # if c in STORE_OPS: |
115 | | - # oparg, = unpack('<H', code[1:3]) |
116 | | - # yield "store", (names[oparg],) |
117 | | - # code = code[3:] |
118 | | - # continue |
119 | | - # if code[:9:3] == LOAD_LOAD_AND_IMPORT: |
120 | | - # oparg_1, oparg_2, oparg_3 = unpack('<xHxHxH', code[:9]) |
121 | | - # level = consts[oparg_1] |
122 | | - # if level == -1: # normal import |
123 | | - # yield "import", (consts[oparg_2], names[oparg_3]) |
124 | | - # elif level == 0: # absolute import |
125 | | - # yield "absolute_import", (consts[oparg_2], names[oparg_3]) |
126 | | - # else: # relative import |
127 | | - # yield "relative_import", (level, consts[oparg_2], names[oparg_3]) |
128 | | - # code = code[9:] |
129 | | - # continue |
130 | | - # if c >= HAVE_ARGUMENT: |
131 | | - # code = code[3:] |
132 | | - # else: |
133 | | - # code = code[1:] |
134 | | - |
135 | 79 | def scan_code(self, co, m): |
136 | 80 | code = co.co_code # noqa |
137 | 81 | # if sys.version_info >= (3, 4): |
|
0 commit comments