Closed as not planned
Description
Bug report
Consider this example:
class My:
def __annotate__(format):
assert format == 2, format
return {}
import annotationlib
annotationlib.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