[Python-checkins] cpython: Fix for last commit on adding reset_name to module_to_load

brett.cannon python-checkins at python.org
Sat Jun 1 00:57:56 CEST 2013


http://hg.python.org/cpython/rev/130dfd6b3428
changeset:   83999:130dfd6b3428
user:        Brett Cannon <brett at python.org>
date:        Fri May 31 18:37:44 2013 -0400
summary:
  Fix for last commit on adding reset_name to module_to_load

files:
  Lib/importlib/_bootstrap.py |  9 ++++++---
  1 files changed, 6 insertions(+), 3 deletions(-)


diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -529,10 +529,13 @@
             del sys.modules[self._name]
 
 
-def module_to_load(name):
-    """Return a context manager which provides the module object to load."""
+def module_to_load(name, *, reset_name=True):
+    """Return a context manager which provides the module object to load.
+
+    If reset_name is true, reset the module's __name__ to 'name'.
+    """
     # Hiding _ModuleManager behind a function for better naming.
-    return _ModuleManager(name)
+    return _ModuleManager(name, reset_name=reset_name)
 
 
 def set_package(fxn):

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list