This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: importlib.metadata Entrypoint has a broken _asdict
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Ronny.Pfannschmidt, jaraco
Priority: normal Keywords: patch

Created on 2021-08-11 21:33 by Ronny.Pfannschmidt, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30150 merged jaraco, 2021-12-16 18:55
Messages (5)
msg399419 - (view) Author: Ronny Pfannschmidt (Ronny.Pfannschmidt) Date: 2021-08-11 21:33
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)
msg399432 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2021-08-12 02:52
I'll probably fix the issue in importlib_metadata first (https://github.com/python/importlib_metadata/issues/337).
msg408733 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2021-12-16 19:38
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.
msg408738 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2021-12-16 20:49
New changeset 04deaee4c8d313717f3ea8f6a4fd70286d510d6e by Jason R. Coombs in branch 'main':
bpo-44893: Implement EntryPoint as simple class with attributes. (GH-30150)
https://github.com/python/cpython/commit/04deaee4c8d313717f3ea8f6a4fd70286d510d6e
msg408746 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2021-12-17 01:06
Expect the fix in 3.11a3.
History
Date User Action Args
2022-04-11 14:59:48adminsetgithub: 89056
2021-12-17 01:06:03jaracosetstatus: open -> closed
resolution: fixed
messages: + msg408746

stage: patch review -> resolved
2021-12-16 20:49:45jaracosetmessages: + msg408738
2021-12-16 19:39:17jaracosetpull_requests: - pull_request28371
2021-12-16 19:38:14jaracosetmessages: + msg408733
versions: - Python 3.8, Python 3.9, Python 3.10
2021-12-16 19:31:05jaracosetpull_requests: + pull_request28371
2021-12-16 18:55:41jaracosetkeywords: + patch
stage: patch review
pull_requests: + pull_request28369
2021-08-12 02:52:34jaracosetmessages: + msg399432
2021-08-12 02:32:23xtreaksetnosy: + jaraco
2021-08-11 21:33:03Ronny.Pfannschmidtcreate