Skip to content

class.__annotations__ gives weird value when using built-in type keywords as attribute #122937

@Heerozh

Description

@Heerozh

Bug report

Bug description:

class some:
    int    : int = 1
    normal : int = 1
some.__annotations__

returns:
{'int': 1, 'normal': 1}

class some:
    int_   : int = 1
    normal : int = 1
some.__annotations__

returns:
{'int_': int, 'normal': int}

CPython versions tested on:

3.11, 3.12

Operating systems tested on:

Linux, Windows

Linked PRs

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions