[Python-checkins] cpython: Issue #27974: Remove importlib._bootstrap._ManageReload.

brett.cannon python-checkins at python.org
Tue Sep 6 19:21:12 EDT 2016


https://hg.python.org/cpython/rev/a3db6e954f58
changeset:   103169:a3db6e954f58
user:        Brett Cannon <brett at python.org>
date:        Tue Sep 06 16:20:46 2016 -0700
summary:
  Issue #27974: Remove importlib._bootstrap._ManageReload.

Class was dead code. Thanks to Xiang Zhang for the patch.

files:
  Lib/importlib/_bootstrap.py |    17 -
  Python/importlib.h          |  3545 +++++++++++-----------
  2 files changed, 1746 insertions(+), 1816 deletions(-)


diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -36,23 +36,6 @@
     return type(sys)(name)
 
 
-class _ManageReload:
-
-    """Manages the possible clean-up of sys.modules for load_module()."""
-
-    def __init__(self, name):
-        self._name = name
-
-    def __enter__(self):
-        self._is_reload = self._name in sys.modules
-
-    def __exit__(self, *args):
-        if any(arg is not None for arg in args) and not self._is_reload:
-            try:
-                del sys.modules[self._name]
-            except KeyError:
-                pass
-
 # Module-level locking ########################################################
 
 # A dict mapping module names to weakrefs of _ModuleLock instances
diff --git a/Python/importlib.h b/Python/importlib.h
--- a/Python/importlib.h
+++ b/Python/importlib.h
[stripped]

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list