New submission from Nikita Sobolev <m...@sobolevn.me>:
Right now in `DeprecatedList` there's a possibly unwated name leak of `method_name` here: https://github.com/python/cpython/blob/08c0ed2d9c0d01ad1a5adc0787bc75e4e90cbb85/Lib/importlib/metadata/__init__.py#L295-L308 ``` for method_name in [ '__setitem__', '__delitem__', 'append', 'reverse', 'extend', 'pop', 'remove', '__iadd__', 'insert', 'sort', ]: locals()[method_name] = _wrap_deprecated_method(method_name) ``` Example: ``` >>> import importlib >>> import importlib.metadata >>> importlib.metadata.DeprecatedList.method_name 'sort' ``` Right now `method_name` is unused, undocumented, and untested. My proposal is to add `del method_name` after the `for` loop, so it won't leak. ---------- components: Library (Lib) messages: 411855 nosy: brett.cannon, jaraco, sobolevn priority: normal severity: normal status: open title: `importlib.metadata.DeprecatedList` leaks `method_name` variable type: behavior versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46546> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com