-
- Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed
Labels
3.14bugs and security fixesbugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
from __future__ import annotations import annotationlib class A: a: int A.__annotations__ = {"a": str} print(A.__annotations__) print(annotationlib.get_annotations(A))this works in 3.14.0a7, has no effect in 3.14.0b1. there seems to be a new attribute __annotations_cache__ that the assignment goes into but it isn't returned from __annotations__:
# 3.14.0a7 $ ~/.venv314a7/bin/python test4.py {'a': <class 'str'>} {'a': <class 'str'>} # 3.14.0b1 $ ~/.venv314/bin/python test4.py {'a': 'int'} {'a': 'int'} If there's a way to get annotationlib.get_annotations() to pick up the change I can use that as a workaround
CPython versions tested on:
3.14
Operating systems tested on:
No response
Linked PRs
JelleZijlstra
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error