]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Minor edit for code clarification in annotationlib. (#124805)
authorlarryhastings <larry@hastings.org>
Mon, 30 Sep 2024 22:25:56 +0000 (15:25 -0700)
committerGitHub <noreply@github.com>
Mon, 30 Sep 2024 22:25:56 +0000 (15:25 -0700)
Lib/annotationlib.py

index a11188722487b2250275805f912686db84214d17..d5166170c071c4b31a1d4207384a73022b726eb6 100644 (file)
@@ -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)