]> granicus.if.org Git - python/commitdiff
Issue #26647: Cleanup modulefinder
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 12 Apr 2016 16:17:06 +0000 (18:17 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 12 Apr 2016 16:17:06 +0000 (18:17 +0200)
Use directly dis.opmap[name] rather than dis.opname.index(name).

Patch written by Demur Rumed.

Lib/modulefinder.py

index 4a2f1b5491186a7e48fe49ab41734a71cc02adbc..d8d645c77bac08e27872e4942bdea716cf8fb538 100644 (file)
@@ -14,11 +14,11 @@ with warnings.catch_warnings():
     import imp
 
 # XXX Clean up once str8's cstor matches bytes.
-LOAD_CONST = bytes([dis.opname.index('LOAD_CONST')])
-IMPORT_NAME = bytes([dis.opname.index('IMPORT_NAME')])
-STORE_NAME = bytes([dis.opname.index('STORE_NAME')])
-STORE_GLOBAL = bytes([dis.opname.index('STORE_GLOBAL')])
-STORE_OPS = [STORE_NAME, STORE_GLOBAL]
+LOAD_CONST = bytes([dis.opmap['LOAD_CONST']])
+IMPORT_NAME = bytes([dis.opmap['IMPORT_NAME']])
+STORE_NAME = bytes([dis.opmap['STORE_NAME']])
+STORE_GLOBAL = bytes([dis.opmap['STORE_GLOBAL']])
+STORE_OPS = STORE_NAME, STORE_GLOBAL
 HAVE_ARGUMENT = bytes([dis.HAVE_ARGUMENT])
 
 # Modulefinder does a good job at simulating Python's, but it can not