Patchwork [STABLE] demandimport: add _imp to ignore list

login
register
mail settings
Submitter Gregory Szorc
Date Feb. 23, 2016, 7:31 p.m.
Message ID <d0b16fca151fb4b19606.1456255902@gps-mbp.local>
Download mbox | patch
Permalink /patch/13322/
State Superseded
Headers show

Comments

Gregory Szorc - Feb. 23, 2016, 7:31 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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.
Pierre-Yves David - Feb. 24, 2016, 10:49 p.m.
On 02/23/2016 08:31 PM, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@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.

Would you add a comment on the same line to indicate were this module 
exclusion is comming from ?

Patch

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