Skip to content

Entrypoint __iter__ implemementation breaks _asdict #337

Description

@RonnyPfannschmidt

def __iter__(self):
"""
Supply iter so one may construct dicts of EntryPoints by name.
"""
msg = (
"Construction of dict of EntryPoints is deprecated in "
"favor of EntryPoints."
)
warnings.warn(msg, DeprecationWarning)
return iter((self.name, self))

#debug from usage of the stdlib copy
(Pdb) v
EntryPoint(name='.git', value='setuptools_scm.git:parse', group='setuptools_scm.parse_scm')
(Pdb) v._asdict()
{'name': '.git', 'value': EntryPoint(name='.git', value='setuptools_scm.git:parse', group='setuptools_scm.parse_scm')}
(Pdb) type(v)
<class 'importlib.metadata.EntryPoint'>
(Pdb) v._fields
('name', 'value', 'group')
(Pdb) 

i was most surprised when my namedtuple debug printer turned into a endless recursion

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions