##// END OF EJS Templates
hgdemandimport: disable on Python 3.5...
Gregory Szorc -
r44576:c5e0a9b9 default
parent child Browse files
Show More
@@ -36,6 +36,12 b' from . import tracing'
36 36
37 37 _deactivated = False
38 38
39 # Python 3.5's LazyLoader doesn't work for some reason.
40 # https://bugs.python.org/issue26186 is a known issue with extension
41 # importing. But it appears to not have a meaningful effect with
42 # Mercurial.
43 _supported = sys.version_info[0:2] >= (3, 6)
44
39 45
40 46 class _lazyloaderex(importlib.util.LazyLoader):
41 47 """This is a LazyLoader except it also follows the _deactivated global and
@@ -51,15 +57,9 b' class _lazyloaderex(importlib.util.LazyL'
51 57 super().exec_module(module)
52 58
53 59
54 # This is 3.6+ because with Python 3.5 it isn't possible to lazily load
55 # extensions. See the discussion in https://bugs.python.org/issue26186 for more.
56 if sys.version_info[0:2] >= (3, 6):
57 _extensions_loader = _lazyloaderex.factory(
58 importlib.machinery.ExtensionFileLoader
59 )
60 else:
61 _extensions_loader = importlib.machinery.ExtensionFileLoader
62
60 _extensions_loader = _lazyloaderex.factory(
61 importlib.machinery.ExtensionFileLoader
62 )
63 63 _bytecode_loader = _lazyloaderex.factory(
64 64 importlib.machinery.SourcelessFileLoader
65 65 )
@@ -97,6 +97,9 b' def disable():'
97 97
98 98
99 99 def enable():
100 if not _supported:
101 return
102
100 103 sys.path_hooks.insert(0, _makefinder)
101 104
102 105
@@ -22,6 +22,10 b' if subprocess.call('
22 22 if sys.flags.optimize:
23 23 sys.exit(80)
24 24
25 # The demand importer doesn't work on Python 3.5.
26 if sys.version_info[0:2] == (3, 5):
27 sys.exit(80)
28
25 29 if ispy3:
26 30 from importlib.util import _LazyModule
27 31
General Comments 0
You need to be logged in to leave comments. Login now