##// END OF EJS Templates
demandimport: add tracing coverage for Python 3...
Augie Fackler -
r42674:adb63639 default
parent child Browse files
Show More
@@ -32,6 +32,8 b' import importlib.machinery'
32 import importlib.util
32 import importlib.util
33 import sys
33 import sys
34
34
35 from . import tracing
36
35 _deactivated = False
37 _deactivated = False
36
38
37 class _lazyloaderex(importlib.util.LazyLoader):
39 class _lazyloaderex(importlib.util.LazyLoader):
@@ -40,10 +42,11 b' class _lazyloaderex(importlib.util.LazyL'
40 """
42 """
41 def exec_module(self, module):
43 def exec_module(self, module):
42 """Make the module load lazily."""
44 """Make the module load lazily."""
43 if _deactivated or module.__name__ in ignores:
45 with tracing.log('demandimport %s', module):
44 self.loader.exec_module(module)
46 if _deactivated or module.__name__ in ignores:
45 else:
47 self.loader.exec_module(module)
46 super().exec_module(module)
48 else:
49 super().exec_module(module)
47
50
48 # This is 3.6+ because with Python 3.5 it isn't possible to lazily load
51 # This is 3.6+ because with Python 3.5 it isn't possible to lazily load
49 # extensions. See the discussion in https://bugs.python.org/issue26186 for more.
52 # extensions. See the discussion in https://bugs.python.org/issue26186 for more.
General Comments 0
You need to be logged in to leave comments. Login now