# HG changeset patch # User Dirkjan Ochtman # Date 2009-02-05 16:40:25 # Node ID 25fc4c620e542f5dd9887c47c08b16bbe2215d61 # Parent 2486980fe21154e226d1bfb2bdec83f5aa8e2545 demandimport: patch __builtin__ instead of __builtins__ This helps on implementations other than CPython, where __builtins__ isn't necessarily defined (as it's an implementation detail for CPython). diff --git a/mercurial/demandimport.py b/mercurial/demandimport.py --- a/mercurial/demandimport.py +++ b/mercurial/demandimport.py @@ -24,6 +24,7 @@ These imports will not be delayed: b = __import__(a) ''' +import __builtin__ _origimport = __import__ class _demandmod(object): @@ -126,9 +127,9 @@ ignore = [ def enable(): "enable global demand-loading of modules" - __builtins__["__import__"] = _demandimport + __builtin__.__import__ = _demandimport def disable(): "disable global demand-loading of modules" - __builtins__["__import__"] = _origimport + __builtin__.__import__ = _origimport