DavidCEllis · GitHub

Bug report

Bug description:

The __qualname__ of __annotate__ functions of methods of classes incorrectly refers to the __annotate__ function of the class itself.

class Example:
    x: int
    def func(self, x: int) -> str: ...
print(f"{Example.__annotate__.__qualname__ = }")
print(f"{Example.func.__annotate__.__qualname__ = }")

Output:

Example.__annotate__.__qualname__ = 'Example.__annotate__'
Example.func.__annotate__.__qualname__ = 'Example.__annotate__'

CPython versions tested on:

3.14, CPython main branch

Operating systems tested on:

No response

Linked PRs

Read the original on github.com ↗