From: Brett Cannon Date: Fri, 31 May 2013 22:37:44 +0000 (-0400) Subject: Fix for last commit on adding reset_name to module_to_load X-Git-Tag: v3.4.0a1~592 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c29cb418224a5f293578628827fbc8a6324de2e0;p=thirdparty%2FPython%2Fcpython.git Fix for last commit on adding reset_name to module_to_load --- diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index cd6a2639118c..d4d2f91c39e5 100644 --- a/Lib/importlib/_bootstrap.py +++ b/Lib/importlib/_bootstrap.py @@ -529,10 +529,13 @@ class _ModuleManager: 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):