[issue46546] `importlib.metadata.DeprecatedList` leaks `method_name` variable

Nikita Sobolev report at bugs.python.org
Thu Jan 27 09:52:17 EST 2022


Nikita Sobolev <mail at sobolevn.me> added the comment:

Thanks, Jason! I've submitted https://github.com/python/importlib_metadata/pull/365

> What's the harm in leaving this attribute on a class that is itself standing in for deprecated behavior and slated for removal?

I think it does not do much harm, but there are several things that it affects:
1. Typing, we have to annotate it in typeshed, or write a custom ignore rule for our test suite
2. It is listed in `help()`:

```
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  __hash__ = None
 |  
 |  method_name = 'sort'
 |  
 |  ----------------------------------------------------------------------
```

3. It is also in `dir(importlib.metadata.DeprecatedList)`

So, even if we remove this class in some time, we still should care about it until the removal :)

I am going to close this as "third party".

----------
resolution:  -> third party
stage: patch review -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46546>
_______________________________________


More information about the Python-bugs-list mailing list