Index: modulefinder.py =================================================================== *** modulefinder.py (Revision 41337) --- modulefinder.py (Arbeitskopie) *************** *** 8,13 **** --- 8,14 ---- import os import sys import new + import struct if hasattr(sys.__stdout__, "newlines"): READ_MODE = "U" # universal line endings *************** *** 15,25 **** # remain compatible with Python < 2.3 READ_MODE = "r" - LOAD_CONST = dis.opname.index('LOAD_CONST') - IMPORT_NAME = dis.opname.index('IMPORT_NAME') - STORE_NAME = dis.opname.index('STORE_NAME') - STORE_GLOBAL = dis.opname.index('STORE_GLOBAL') - STORE_OPS = [STORE_NAME, STORE_GLOBAL] # Modulefinder does a good job at simulating Python's, but it can not # handle __path__ modifications packages make at runtime. Therefore there --- 16,21 ---- *************** *** 317,341 **** fullname = name + "." + sub self._add_badmodule(fullname, caller) ! def scan_code(self, co, m): code = co.co_code n = len(code) i = 0 fromlist = None while i < n: c = code[i] i = i+1 ! op = ord(c) ! if op >= dis.HAVE_ARGUMENT: ! oparg = ord(code[i]) + ord(code[i+1])*256 i = i+2 ! if op == LOAD_CONST: # An IMPORT_NAME is always preceded by a LOAD_CONST, it's # a tuple of "from" names, or None for a regular import. # The tuple may contain "*" for "from import *" ! fromlist = co.co_consts[oparg] ! elif op == IMPORT_NAME: assert fromlist is None or type(fromlist) is tuple name = co.co_names[oparg] have_star = 0 if fromlist is not None: --- 313,345 ---- fullname = name + "." + sub self._add_badmodule(fullname, caller) ! def scan_code(self, co, m, ! HAVE_ARGUMENT = chr(dis.HAVE_ARGUMENT), ! LOAD_CONST = chr(dis.opname.index('LOAD_CONST')), ! IMPORT_NAME = chr(dis.opname.index('IMPORT_NAME')), ! STORE_OPS = [chr(dis.opname.index('STORE_NAME')), ! chr(dis.opname.index('STORE_GLOBAL'))], ! unpack = struct.unpack ! ): code = co.co_code + constants = co.co_consts n = len(code) i = 0 fromlist = None while i < n: c = code[i] i = i+1 ! if c >= HAVE_ARGUMENT: i = i+2 ! if c == LOAD_CONST: # An IMPORT_NAME is always preceded by a LOAD_CONST, it's # a tuple of "from" names, or None for a regular import. # The tuple may contain "*" for "from import *" ! oparg = unpack('