class.__annotations__ gives weird value when using built-in type keywords as attribute
Open
@sobolevn is already working on this.
Since Aug 12, 2024.
docs
topic-typing
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
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
- gh-123060
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.