From e1515b5763b40ed5133dc202a563221c84a4222c Mon Sep 17 00:00:00 2001 From: Larry Hastings Date: Mon, 30 Sep 2024 14:44:17 -0700 Subject: [PATCH] Minor edit for code clarification in annotationlib. --- Lib/annotationlib.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Lib/annotationlib.py b/Lib/annotationlib.py index a11188722487b2..d5166170c071c4 100644 --- a/Lib/annotationlib.py +++ b/Lib/annotationlib.py @@ -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)