Mercurial > cpython-lru_cache-weakref
diff Lib/importlib/_bootstrap.py @ 83999:130dfd6b3428
Fix for last commit on adding reset_name to module_to_load
| author | Brett Cannon <brett@python.org> |
|---|---|
| date | Fri, 31 May 2013 18:37:44 -0400 |
| parents | 39cc1b04713e |
| children | e873f2e67353 |
line wrap: on
line diff
--- a/Lib/importlib/_bootstrap.py Fri May 31 18:11:17 2013 -0400 +++ b/Lib/importlib/_bootstrap.py Fri May 31 18:37:44 2013 -0400 @@ -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):
