Skip to content

NotImplementedError raised by annotationlib (?) when importing classes derived from NamedTuple #128089

Closed
@befeleme

Description

@befeleme

Bug report

Bug description:

With 3.14.0a3 there is an issue which affects all of the building block packages: setuptools, pip, wheel, causing failure to build of over 2800 packages in Fedora Linux total.

In cases I explored, the issue appears when importing classes derived from NamedTuple.
To reproduce in the Python 3.14.0a3 interpreter:

>>> import setuptools.package_index
Traceback (most recent call last):
  File "<python-input-18>", line 1, in <module>
    import setuptools.package_index
  File "/usr/lib/python3.14/site-packages/setuptools/package_index.py", line 1005, in <module>
    class Credential(NamedTuple):
    ...<12 lines>...
            return f'{self.username}:{self.password}'
  File "/usr/lib64/python3.14/typing.py", line 2971, in __new__
    types = annotationlib.call_annotate_function(original_annotate, annotationlib.Format.FORWARDREF)
  File "/usr/lib64/python3.14/annotationlib.py", line 613, in call_annotate_function
    result = func(Format.VALUE_WITH_FAKE_GLOBALS)
  File "/usr/lib/python3.14/site-packages/setuptools/package_index.py", line 1005, in __annotate__
    class Credential(NamedTuple):
    
NotImplementedError

The class in question looks like this: https://github.com/pypa/setuptools/blob/main/setuptools/package_index.py#L1003

CPython versions tested on:

3.14

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.14bugs and security fixestopic-typingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions