Patchwork [1,of,3] demandimport: add '_ctypes.pointer' to ignore list on PyPy

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 27, 2016, 2:12 p.m.
Message ID <082f29026f21f6bae461.1474985534@mimosa>
Download mbox | patch
Permalink /patch/16791/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 27, 2016, 2:12 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1474983360 -32400
#      Tue Sep 27 22:36:00 2016 +0900
# Node ID 082f29026f21f6bae4615adbeb6a963eaf7029ea
# Parent  e83f89d3b1f733d0ee5f23f6a2293279a17fbbfb
demandimport: add '_ctypes.pointer' to ignore list on PyPy

The pointer module is shadowed by a subsequent import. Our demand importer
can't handle this because both sub modules and attributes live in the same
namespace.

https://bitbucket.org/pypy/pypy/src/release-5.0.1/lib_pypy/_ctypes/__init__.py#__init__.py-5

Patch

diff --git a/mercurial/demandimport.py b/mercurial/demandimport.py
--- a/mercurial/demandimport.py
+++ b/mercurial/demandimport.py
@@ -287,6 +287,12 @@  ignore = [
     'distutils.msvc9compiler',
     ]
 
+if _pypy:
+    ignore.extend([
+        # _ctypes.pointer is shadowed by "from ... import pointer" (PyPy 5)
+        '_ctypes.pointer',
+    ])
+
 def isenabled():
     return builtins.__import__ == _demandimport