[PATCH STABLE] demandimport: add _imp to ignore list

Gregory Szorc gregory.szorc at gmail.com
Tue Feb 23 19:31:42 UTC 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1456254743 28800
#      Tue Feb 23 11:12:23 2016 -0800
# Branch stable
# Node ID d0b16fca151fb4b19606def48500ee90ca09e55c
# Parent  1bcb4f34b9f91a2e330966182f691664fbada1bc
demandimport: add _imp to ignore list

Mozilla is seeing an issue with demand importing of _imp
failing in pkg_resources/__init__.py:fixup_namespace_packages.
It strangely only reproduces when using a modern version of
setuptools/pip in certain scenarios. Adding _imp to the demand import
ignore list seems to make the problem go away.

diff --git a/mercurial/demandimport.py b/mercurial/demandimport.py
--- a/mercurial/demandimport.py
+++ b/mercurial/demandimport.py
@@ -229,8 +229,9 @@ def _demandimport(name, globals=None, lo
 
 ignore = [
     '__future__',
     '_hashlib',
+    '_imp',
     '_xmlplus',
     'fcntl',
     'win32com.gen_py',
     '_winreg', # 2.7 mimetypes needs immediate ImportError


More information about the Mercurial-devel mailing list