hgdemandimport/demandimportpy3.py
changeset 37843 670eb4fa1b86
parent 35524 fcb1ecf2bef7
child 42474 adb636392b3f
equal deleted inserted replaced
37840:853001c84114 37843:670eb4fa1b86
    38     """This is a LazyLoader except it also follows the _deactivated global and
    38     """This is a LazyLoader except it also follows the _deactivated global and
    39     the ignore list.
    39     the ignore list.
    40     """
    40     """
    41     def exec_module(self, module):
    41     def exec_module(self, module):
    42         """Make the module load lazily."""
    42         """Make the module load lazily."""
    43         if _deactivated or module.__name__ in ignore:
    43         if _deactivated or module.__name__ in ignores:
    44             self.loader.exec_module(module)
    44             self.loader.exec_module(module)
    45         else:
    45         else:
    46             super().exec_module(module)
    46             super().exec_module(module)
    47 
    47 
    48 # This is 3.6+ because with Python 3.5 it isn't possible to lazily load
    48 # This is 3.6+ because with Python 3.5 it isn't possible to lazily load
    60         (_extensions_loader, importlib.machinery.EXTENSION_SUFFIXES),
    60         (_extensions_loader, importlib.machinery.EXTENSION_SUFFIXES),
    61         (_source_loader, importlib.machinery.SOURCE_SUFFIXES),
    61         (_source_loader, importlib.machinery.SOURCE_SUFFIXES),
    62         (_bytecode_loader, importlib.machinery.BYTECODE_SUFFIXES),
    62         (_bytecode_loader, importlib.machinery.BYTECODE_SUFFIXES),
    63     )
    63     )
    64 
    64 
    65 ignore = []
    65 ignores = set()
    66 
    66 
    67 def init(ignorelist):
    67 def init(ignoreset):
    68     global ignore
    68     global ignores
    69     ignore = ignorelist
    69     ignores = ignoreset
    70 
    70 
    71 def isenabled():
    71 def isenabled():
    72     return _makefinder in sys.path_hooks and not _deactivated
    72     return _makefinder in sys.path_hooks and not _deactivated
    73 
    73 
    74 def disable():
    74 def disable():