diff --git a/Lib/importlib/metadata/__init__.py b/Lib/importlib/metadata/__init__.py index 371c48220958629..9397191648298b1 100644 --- a/Lib/importlib/metadata/__init__.py +++ b/Lib/importlib/metadata/__init__.py @@ -305,6 +305,7 @@ def wrapped(self, *args, **kwargs): 'sort', ]: locals()[method_name] = _wrap_deprecated_method(method_name) + del method_name def __add__(self, other): if not isinstance(other, tuple): diff --git a/Misc/NEWS.d/next/Library/2022-01-27-14-25-42.bpo-46546.rpSN2y.rst b/Misc/NEWS.d/next/Library/2022-01-27-14-25-42.bpo-46546.rpSN2y.rst new file mode 100644 index 000000000000000..9f81621115db6ee --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-01-27-14-25-42.bpo-46546.rpSN2y.rst @@ -0,0 +1,2 @@ +Remove ``method_name`` var leak from +:class:`importlib.metadata.DeprecatedList`.