class My:
def __annotate__(format):
assert format == 2, format
return {}
import annotationlib
annotationlib.get_annotations(My, format=2)
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