Skip to content

Commit

Permalink
Merge pull request #365 from sobolevn/patch-1
Browse files Browse the repository at this point in the history
Do not leak `method_name` in `DeprecatedList`
  • Loading branch information
jaraco authored Jan 28, 2022
2 parents 9911bde + 30a199a commit 7a98b78
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v4.10.2
=======

* #365 and bpo-46546: Avoid leaking ``method_name`` in
``DeprecatedList``.

v4.10.1
=======

Expand Down
24 changes: 9 additions & 15 deletions importlib_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,21 +295,15 @@ def wrapped(self, *args, **kwargs):
self._warn()
return getattr(super(), method_name)(*args, **kwargs)

return wrapped

for method_name in [
'__setitem__',
'__delitem__',
'append',
'reverse',
'extend',
'pop',
'remove',
'__iadd__',
'insert',
'sort',
]:
locals()[method_name] = _wrap_deprecated_method(method_name)
return method_name, wrapped

locals().update(
map(
_wrap_deprecated_method,
'__setitem__ __delitem__ append reverse extend pop remove '
'__iadd__ insert sort'.split(),
)
)

def __add__(self, other):
if not isinstance(other, tuple):
Expand Down

0 comments on commit 7a98b78

Please sign in to comment.