mirror of
https://github.com/python/cpython.git
synced 2025-09-15 13:16:12 +00:00
bpo-46246: add missing __slots__ to importlib.metadata.DeprecatedList (GH-30452)
Confirmed with @jaraco that this indeed needs a fix. A question that came up while I was digging into the code: I think `SelectableGroups` could similarly use `__slots__ = ()`, since its purpose seems only for convenience around `dict`, not to have attributes of its own. Automerge-Triggered-By: GH:jaraco
This commit is contained in:
parent
80e4f262aa
commit
dd76b3f7d3
3 changed files with 9 additions and 0 deletions
|
@ -278,6 +278,8 @@ class DeprecatedList(list):
|
||||||
1
|
1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__slots__ = ()
|
||||||
|
|
||||||
_warn = functools.partial(
|
_warn = functools.partial(
|
||||||
warnings.warn,
|
warnings.warn,
|
||||||
"EntryPoints list interface is deprecated. Cast to list if needed.",
|
"EntryPoints list interface is deprecated. Cast to list if needed.",
|
||||||
|
|
|
@ -172,6 +172,11 @@ class APITests(
|
||||||
entry_points().get('entries', 'default') == entry_points()['entries']
|
entry_points().get('entries', 'default') == entry_points()['entries']
|
||||||
entry_points().get('missing', ()) == ()
|
entry_points().get('missing', ()) == ()
|
||||||
|
|
||||||
|
def test_entry_points_allows_no_attributes(self):
|
||||||
|
ep = entry_points().select(group='entries', name='main')
|
||||||
|
with self.assertRaises(AttributeError):
|
||||||
|
ep.foo = 4
|
||||||
|
|
||||||
def test_metadata_for_this_package(self):
|
def test_metadata_for_this_package(self):
|
||||||
md = metadata('egginfo-pkg')
|
md = metadata('egginfo-pkg')
|
||||||
assert md['author'] == 'Steven Ma'
|
assert md['author'] == 'Steven Ma'
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Add missing ``__slots__`` to ``importlib.metadata.DeprecatedList``. Patch by
|
||||||
|
Arie Bovenberg.
|
Loading…
Add table
Add a link
Reference in a new issue