Skip to content

Attribute __annotations__ containd in FunctionType.__dict__ but is not an attribute of "FunctionType" itself #133819

Open
@siegbert7

Description

@siegbert7

Bug report

Bug description:

# Inconsistency between FunctionType and its __dict__

from  types import FunctionType as FunctionType

print(FunctionType.__dict__['__annotations__'])       # <attribute '__annotations__' of 'function' objects>
print(FunctionType.__annotations__)                   # AttributeError: type object 'function' has no attribute '__annotations__'

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)topic-typingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions