Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed as not planned
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
Consider this example:
classMy: def__annotate__(format): assertformat==2, formatreturn{} importannotationlibannotationlib.get_annotations(My, format=2)This will fail with:
Traceback (most recent call last): File "/Users/sobolev/Desktop/cpython2/ex.py", line 7, in <module> annotationlib.get_annotations(My, format=2) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^ File "/Users/sobolev/Desktop/cpython2/Lib/annotationlib.py", line 688, in get_annotations return dict(_get_dunder_annotations(obj)) ~~~~~~~~~~~~~~~~~~~~~~~^^^^^ File "/Users/sobolev/Desktop/cpython2/Lib/annotationlib.py", line 817, in _get_dunder_annotations ann = _BASE_GET_ANNOTATIONS(obj) File "/Users/sobolev/Desktop/cpython2/ex.py", line 3, in __annotate__ assert format == 2, format ^^^^^^^^^^^ AssertionError: 1 I think that we should still pass the format in _BASE_GET_ANNOTATIONS.
I will try to fix this, since this affects my other PR: #122262
Linked PRs
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