mirror of
https://github.com/python/cpython.git
synced 2025-07-19 09:15:34 +00:00
Issue #27974: Remove importlib._bootstrap._ManageReload.
Class was dead code. Thanks to Xiang Zhang for the patch.
This commit is contained in:
parent
9b1f474df6
commit
eaecc692df
2 changed files with 1749 additions and 1819 deletions
|
@ -36,23 +36,6 @@ def _new_module(name):
|
||||||
return type(sys)(name)
|
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 ########################################################
|
# Module-level locking ########################################################
|
||||||
|
|
||||||
# A dict mapping module names to weakrefs of _ModuleLock instances
|
# A dict mapping module names to weakrefs of _ModuleLock instances
|
||||||
|
|
3551
Python/importlib.h
3551
Python/importlib.h
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue