[PATCH 1 of 5] mercurial: use pure Python module policy on Python 3

Gregory Szorc gregory.szorc at gmail.com
Sat Mar 12 17:11:32 EST 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1457817559 28800
#      Sat Mar 12 13:19:19 2016 -0800
# Node ID afb4d2d519921346fd33b05880c677740ac8f086
# Parent  d205c5f57b97ef6e26a85002022c940040c57169
mercurial: use pure Python module policy on Python 3

The C extensions don't yet work with Python 3. Let's minimize the
work required to get Mercurial running on Python 3 by always using
the pure Python module policy on Python 3.

diff --git a/mercurial/__init__.py b/mercurial/__init__.py
--- a/mercurial/__init__.py
+++ b/mercurial/__init__.py
@@ -30,16 +30,21 @@ except ImportError:
 
 # 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'
 
+# Our C extensions aren't yet compatible with Python 3. So use pure Python
+# on Python 3 for now.
+if sys.version_info[0] >= 3:
+    modulepolicy = 'py'
+
 # Environment variable can always force settings.
 modulepolicy = os.environ.get('HGMODULEPOLICY', modulepolicy)
 
 # Modules that have both Python and C implementations. See also the
 # set of .py files under mercurial/pure/.
 _dualmodules = set([
     'mercurial.base85',
     'mercurial.bdiff',


More information about the Mercurial-devel mailing list