Skip to content

Commit bd25af7

Browse files
committed
Restore support for EntryPoint construction with positional args.
1 parent 86b5a28 commit bd25af7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

importlib_metadata/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class EntryPoint:
156156

157157
dist: Optional['Distribution'] = None
158158

159-
def __init__(self, *, name, value, group):
159+
def __init__(self, name, value, group):
160160
vars(self).update(name=name, value=value, group=group)
161161

162162
def load(self):

tests/test_main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ def test_entry_point_pickleable(self):
232232
revived = pickle.loads(pickle.dumps(self.ep))
233233
assert revived == self.ep
234234

235+
def test_positional_args(self):
236+
"""
237+
Capture legacy (namedtuple) construction, discouraged.
238+
"""
239+
EntryPoint('name', 'value', 'group')
240+
235241
def test_immutable(self):
236242
"""EntryPoints should be immutable"""
237243
with self.assertRaises(AttributeError):

0 commit comments

Comments
 (0)