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

login
register
mail settings
Submitter Gregory Szorc
Date March 12, 2016, 10:11 p.m.
Message ID <afb4d2d519921346fd33.1457820692@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/13833/
State Accepted
Headers show

Comments

Gregory Szorc - March 12, 2016, 10:11 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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.
Pierre-Yves David - March 14, 2016, 11:43 p.m.
On 03/12/2016 10:11 PM, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@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

That first one is on the clowncopter, thanks

Patch

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',