diff options
author | Brett Cannon <brett@python.org> | 2013-05-31 22:37:44 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-05-31 22:37:44 (GMT) |
commit | c29cb418224a5f293578628827fbc8a6324de2e0 (patch) | |
tree | a9825ba1b70cf4838b545ada7ea9b7e9a0a71300 /Lib/importlib/_bootstrap.py | |
parent | b60a43eabf0ee17599caec484f4fe472cb4f36fe (diff) | |
download | cpython-c29cb418224a5f293578628827fbc8a6324de2e0.zip cpython-c29cb418224a5f293578628827fbc8a6324de2e0.tar.gz cpython-c29cb418224a5f293578628827fbc8a6324de2e0.tar.bz2 |
Fix for last commit on adding reset_name to module_to_load
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index cd6a263..d4d2f91 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): |