Fix for last commit on adding reset_name to module_to_load

This commit is contained in:
Brett Cannon 2013-05-31 18:37:44 -04:00
parent b60a43eabf
commit c29cb41822
1 changed files with 6 additions and 3 deletions

View File

@ -529,10 +529,13 @@ class _ModuleManager:
del sys.modules[self._name] del sys.modules[self._name]
def module_to_load(name): def module_to_load(name, *, reset_name=True):
"""Return a context manager which provides the module object to load.""" """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. # Hiding _ModuleManager behind a function for better naming.
return _ModuleManager(name) return _ModuleManager(name, reset_name=reset_name)
def set_package(fxn): def set_package(fxn):