Skip to content

importlib.metadata Entrypoint has a broken _asdict #89056

Closed

Description

@RonnyPfannschmidt
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']

    Activity

    1. RonnyPfannschmidt commented on Aug 11, 2021

      RonnyPfannschmidtmannequin
      MannequinAuthor

      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)
      
    2. added
      3.11only security fixes
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Aug 11, 2021
    3. jaraco commented on Aug 12, 2021

      @jaraco
      Member

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

    4. jaraco commented on Dec 16, 2021

      @jaraco
      Member

      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.

    5. jaraco commented on Dec 16, 2021

      @jaraco
      Member

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

    6. jaraco commented on Dec 17, 2021

      @jaraco
      Member

      Expect the fix in 3.11a3.

    7. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.11only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions