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
cc @JelleZijlstra
CPython versions tested on:
3.14
Operating systems tested on:
No response
Linked PRs