Patchwork [STABLE,v2] demandimport: add _imp to ignore list

login
register
mail settings
Submitter Gregory Szorc
Date Feb. 26, 2016, 6:40 a.m.
Message ID <1d9f3f93a47481ffe155.1456468804@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/13401/
State Accepted
Headers show

Comments

Gregory Szorc - Feb. 26, 2016, 6:40 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1456468511 28800
#      Thu Feb 25 22:35:11 2016 -0800
# Branch stable
# Node ID 1d9f3f93a47481ffe155e8beb801ff56e7c22d46
# Parent  2d437a0f3355834a9485bbbeb30a52a052c98f19
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.

Patch

diff --git a/mercurial/demandimport.py b/mercurial/demandimport.py
--- a/mercurial/demandimport.py
+++ b/mercurial/demandimport.py
@@ -211,16 +211,18 @@  def _demandimport(name, globals=None, lo
         for x in fromlist:
             processfromitem(mod, x)
 
         return mod
 
 ignore = [
     '__future__',
     '_hashlib',
+    # ImportError during pkg_resources/__init__.py:fixup_namespace_package
+    '_imp',
     '_xmlplus',
     'fcntl',
     'win32com.gen_py',
     '_winreg', # 2.7 mimetypes needs immediate ImportError
     'pythoncom',
     # imported by tarfile, not available under Windows
     'pwd',
     'grp',