[Python-checkins] r55594 - sandbox/trunk/import_in_py/controlled_importlib.py

brett.cannon python-checkins at python.org
Sat May 26 01:29:03 CEST 2007


Author: brett.cannon
Date: Sat May 26 01:28:57 2007
New Revision: 55594

Modified:
   sandbox/trunk/import_in_py/controlled_importlib.py
Log:
Make it so that the loss of open() from the built-in namespace does not prevent
importlib from being able to open Python source and bytecode files.


Modified: sandbox/trunk/import_in_py/controlled_importlib.py
==============================================================================
--- sandbox/trunk/import_in_py/controlled_importlib.py	(original)
+++ sandbox/trunk/import_in_py/controlled_importlib.py	Sat May 26 01:28:57 2007
@@ -14,6 +14,11 @@
 import importlib
 import sys
 
+# Need to inject 'open' into importlib as it will most likely be removed from
+# the built-in namespace.
+importlib.open = open
+
+
 class Whitelister(object):
 
     """Whitelist the finding and/or loading of modules."""
@@ -58,6 +63,7 @@
 
     pass
 
+
 class WhitelistExtHandler(importlib.ExtensionFileHandler):
 
     """Add whitelisting to the extension module handler."""


More information about the Python-checkins mailing list