Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importlib.metadata Entrypoint has a broken _asdict #89056

Closed
RonnyPfannschmidt mannequin opened this issue Aug 11, 2021 · 5 comments
Closed

importlib.metadata Entrypoint has a broken _asdict #89056

RonnyPfannschmidt mannequin opened this issue Aug 11, 2021 · 5 comments
Labels
3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@RonnyPfannschmidt
Copy link
Mannequin

RonnyPfannschmidt mannequin commented Aug 11, 2021

BPO 44893
Nosy @jaraco, @RonnyPfannschmidt
PRs
  • bpo-44893: Implement EntryPoint as simple class with attributes. #30150
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2021-12-17.01:06:03.591>
    created_at = <Date 2021-08-11.21:33:03.545>
    labels = ['type-bug', 'library', '3.11']
    title = 'importlib.metadata Entrypoint has a broken _asdict'
    updated_at = <Date 2021-12-17.01:06:03.590>
    user = 'https://github.com/RonnyPfannschmidt'

    bugs.python.org fields:

    activity = <Date 2021-12-17.01:06:03.590>
    actor = 'jaraco'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-12-17.01:06:03.591>
    closer = 'jaraco'
    components = ['Library (Lib)']
    creation = <Date 2021-08-11.21:33:03.545>
    creator = 'Ronny.Pfannschmidt'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44893
    keywords = ['patch']
    message_count = 5.0
    messages = ['399419', '399432', '408733', '408738', '408746']
    nosy_count = 2.0
    nosy_names = ['jaraco', 'Ronny.Pfannschmidt']
    pr_nums = ['30150']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue44893'
    versions = ['Python 3.11']

    @RonnyPfannschmidt
    Copy link
    Mannequin Author

    RonnyPfannschmidt mannequin commented Aug 11, 2021

    due to

     def __iter__(self):
            """
            Supply iter so one may construct dicts of EntryPoints easily.
            """
            return iter((self.name, self))
    

    the default namedtuple asdict method is broken

    instead of returning the fields, recursive objects are returned as

    (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)
    

    @RonnyPfannschmidt RonnyPfannschmidt mannequin added 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes 3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Aug 11, 2021
    @jaraco
    Copy link
    Member

    jaraco commented Aug 12, 2021

    I'll probably fix the issue in importlib_metadata first (python/importlib_metadata#337).

    @jaraco
    Copy link
    Member

    jaraco commented Dec 16, 2021

    The change as implemented for importlib_metadata involves refactorings that can't be backported, so the fix will only go into Python 3.11. I'll consider backporting a more selective fix for this issue if it's important, but I suspect there may not be, given that Ronny has reported that he's already migrated to a solution accessing by attribute.

    @jaraco jaraco removed 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels Dec 16, 2021
    @jaraco
    Copy link
    Member

    jaraco commented Dec 16, 2021

    New changeset 04deaee by Jason R. Coombs in branch 'main':
    bpo-44893: Implement EntryPoint as simple class with attributes. (GH-30150)
    04deaee

    @jaraco
    Copy link
    Member

    jaraco commented Dec 17, 2021

    Expect the fix in 3.11a3.

    @jaraco jaraco closed this as completed Dec 17, 2021
    @jaraco jaraco closed this as completed Dec 17, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant