changeset 27069:4e554a7df1e9

demandimport: don't enable when running under PyPy On demand importing doesn't work with PyPy for some reason. Don't honor requests to enable demand importing when running under PyPy.
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 21 Nov 2015 22:28:01 -0800
parents 9eeca021a803
children 7860366b46c9
files mercurial/demandimport.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/demandimport.py	Sat Nov 14 17:14:14 2015 -0800
+++ b/mercurial/demandimport.py	Sat Nov 21 22:28:01 2015 -0800
@@ -245,6 +245,10 @@
 
 def enable():
     "enable global demand-loading of modules"
+    # PyPy doesn't work with demand import.
+    if '__pypy__' in sys.builtin_module_names:
+        return
+
     if os.environ.get('HGDEMANDIMPORT') != 'disable':
         builtins.__import__ = _demandimport