This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sobolevn
Recipients brett.cannon, jaraco, sobolevn
Date 2022-01-27.11:24:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643282692.82.0.294408730959.issue46546@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2022-01-27 11:24:52sobolevnsetrecipients: + sobolevn, brett.cannon, jaraco
2022-01-27 11:24:52sobolevnsetmessageid: <1643282692.82.0.294408730959.issue46546@roundup.psfhosted.org>
2022-01-27 11:24:52sobolevnlinkissue46546 messages
2022-01-27 11:24:52sobolevncreate