[PATCH] demandimport: disable lazy import of __builtin__

Mads Kiilerich mads at kiilerich.com
Fri Oct 14 01:03:55 UTC 2016


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1476407019 -7200
#      Fri Oct 14 03:03:39 2016 +0200
# Node ID c0fd76f612735f0354102603ee630437208d8336
# Parent  c0410814002f467c24ef07ce73850ba15b306f8e
demandimport: disable lazy import of __builtin__

Demandimport uses the "try to import __builtin__, else use builtins" trick to
handle Python 3. External libraries and extensions might do something similar.
On Fedora 25 subversion-python-1.9.4-4.fc25.x86_64 will do just that (except
the opposite) ... and it failed all subversion convert tests because
demandimport was hiding that it didn't have builtins but should use
__builtin__.

The builtin module has already been imported when demandimport is loaded so
there is no point in trying to import it on demand. Just always ignore both
variants in demandimport.

diff --git a/mercurial/demandimport.py b/mercurial/demandimport.py
--- a/mercurial/demandimport.py
+++ b/mercurial/demandimport.py
@@ -291,6 +291,8 @@ ignore = [
     'sqlalchemy.events', # has import-time side effects (issue5085)
     # setuptools 8 expects this module to explode early when not on windows
     'distutils.msvc9compiler',
+    '__builtin__',
+    'builtins',
     ]
 
 if _pypy:


More information about the Mercurial-devel mailing list