Skip to content

PEP 649: generated __annotate__ functions have incorrect qualified names #8493

Closed

Description

@youknowone

Feature

RustPython implements deferred annotations, but compiler-generated __annotate__ functions do not consistently receive the CPython-compatible __qualname__.

Minimal reproduction:

def f() -> None:
    pass

class Outer:
    x: int

    def method(self, x: int):
        pass

print(f.__annotate__.__name__, f.__annotate__.__qualname__)
print(Outer.__annotate__.__name__, Outer.__annotate__.__qualname__)
print(Outer.method.__annotate__.__name__, Outer.method.__annotate__.__qualname__)

CPython 3.14.6:

__annotate__ f.__annotate__
__annotate__ Outer.__annotate__
__annotate__ Outer.method.__annotate__

RustPython:

__annotate__ __annotate__
__annotate__ Outer.__annotate__
__annotate__ Outer.__annotate__

This is already represented by the expectedFailure marker on RegressionTests.test_annotate_qualname in Lib/test/test_type_annotations.py.

Python Documentation or reference to CPython source code

Activity

  1. added
    C-compat
    on Aug 11, 2026
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

    C-compat

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions