-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed as not planned
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
In Python 3.13 ("stock semantics") this code
x: int
print(__annotations__)
prints
{'x': <class 'int'>}
In Python 3.14 rc1 we get an error message:
Traceback (most recent call last):
File "D:\brython\20221025\www\tests\module2.py", line 2, in <module>
print(__annotations__)
^^^^^^^^^^^^^^^
NameError: name '__annotations__' is not defined. Did you mean: '__annotate__'?
Using module annotationlib changes the result:
x: int
import annotationlib
import sys
print('with annotationlib', annotationlib.get_annotations(sys.modules[__name__]))
print('__annotations__', __annotations__)
prints
with annotationlib {'x': <class 'int'>}
__annotations__ {'x': <class 'int'>}
CPython versions tested on:
3.14
Operating systems tested on:
No response
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error