Skip to content
Snippets Groups Projects
Commit 2d31ef3fb494 authored by Gregory Szorc's avatar Gregory Szorc
Browse files

demandimportpy3: only use lazy extension loader on Python 3.6+

There was an inline comment denoting a bug in the lazy extension
loader on Python 3.5 which prevents it from working there. But the
code was not conditional on the Python version.

The result of this was a myriad of failures on Python 3.5 due to
getattr() and friends not working on lazy extension modules.

By making extension modules non-lazy on Python 3.5, we reduce the
number of test failures from 48 to 22 on that Python version.
parent aaa046919043
No related branches found
No related tags found
No related merge requests found
......@@ -53,9 +53,13 @@
# This is 3.6+ because with Python 3.5 it isn't possible to lazily load
# extensions. See the discussion in https://bugs.python.org/issue26186 for more.
_extensions_loader = _lazyloaderex.factory(
importlib.machinery.ExtensionFileLoader
)
if sys.version_info[0:2] >= (3, 6):
_extensions_loader = _lazyloaderex.factory(
importlib.machinery.ExtensionFileLoader
)
else:
_extensions_loader = importlib.machinery.ExtensionFileLoader
_bytecode_loader = _lazyloaderex.factory(
importlib.machinery.SourcelessFileLoader
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment