Skip to content

Commit c29cb41

Browse files
committed
Fix for last commit on adding reset_name to module_to_load
1 parent b60a43e commit c29cb41

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Lib/importlib/_bootstrap.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,13 @@ def __exit__(self, *args):
529529
del sys.modules[self._name]
530530

531531

532-
def module_to_load(name):
533-
"""Return a context manager which provides the module object to load."""
532+
def module_to_load(name, *, reset_name=True):
533+
"""Return a context manager which provides the module object to load.
534+
535+
If reset_name is true, reset the module's __name__ to 'name'.
536+
"""
534537
# Hiding _ModuleManager behind a function for better naming.
535-
return _ModuleManager(name)
538+
return _ModuleManager(name, reset_name=reset_name)
536539

537540

538541
def set_package(fxn):

0 commit comments

Comments
 (0)