Skip to content

Commit 7a98b78

Browse files
authored
Merge pull request #365 from sobolevn/patch-1
Do not leak `method_name` in `DeprecatedList`
2 parents 9911bde + 30a199a commit 7a98b78

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
v4.10.2
2+
=======
3+
4+
* #365 and bpo-46546: Avoid leaking ``method_name`` in
5+
``DeprecatedList``.
6+
17
v4.10.1
28
=======
39

importlib_metadata/__init__.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -295,21 +295,15 @@ def wrapped(self, *args, **kwargs):
295295
self._warn()
296296
return getattr(super(), method_name)(*args, **kwargs)
297297

298-
return wrapped
299-
300-
for method_name in [
301-
'__setitem__',
302-
'__delitem__',
303-
'append',
304-
'reverse',
305-
'extend',
306-
'pop',
307-
'remove',
308-
'__iadd__',
309-
'insert',
310-
'sort',
311-
]:
312-
locals()[method_name] = _wrap_deprecated_method(method_name)
298+
return method_name, wrapped
299+
300+
locals().update(
301+
map(
302+
_wrap_deprecated_method,
303+
'__setitem__ __delitem__ append reverse extend pop remove '
304+
'__iadd__ insert sort'.split(),
305+
)
306+
)
313307

314308
def __add__(self, other):
315309
if not isinstance(other, tuple):

0 commit comments

Comments
 (0)