mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
Minor edit for code clarification in annotationlib. (#124805)
This commit is contained in:
parent
7e7223e18f
commit
626d706a66
1 changed files with 1 additions and 3 deletions
|
@ -685,11 +685,9 @@ def get_annotations(
|
|||
case Format.FORWARDREF:
|
||||
# For FORWARDREF, we use __annotations__ if it exists
|
||||
try:
|
||||
ann = _get_dunder_annotations(obj)
|
||||
return dict(_get_dunder_annotations(obj))
|
||||
except NameError:
|
||||
pass
|
||||
else:
|
||||
return dict(ann)
|
||||
|
||||
# But if __annotations__ threw a NameError, we try calling __annotate__
|
||||
ann = _get_and_call_annotate(obj, format)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue