mercurial/__init__.py
changeset 27224 d308a9ca9ed7
parent 27223 a40c84defd76
child 27225 30a20167ae29
--- a/mercurial/__init__.py	Tue Nov 24 22:50:04 2015 -0800
+++ b/mercurial/__init__.py	Tue Nov 24 22:21:51 2015 -0800
@@ -24,6 +24,13 @@
 if modulepolicy == '@' 'MODULELOADPOLICY' '@':
     modulepolicy = 'c'
 
+# PyPy doesn't load C extensions.
+#
+# The canonical way to do this is to test platform.python_implementation().
+# But we don't import platform and don't bloat for it here.
+if '__pypy__' in sys.builtin_module_names:
+    modulepolicy = 'py'
+
 # Environment variable can always force settings.
 modulepolicy = os.environ.get('HGMODULEPOLICY', modulepolicy)