https://github.com/python/cpython/commit/626d706a666e95e696aaa3af2e8728514d31da21
commit: 626d706a666e95e696aaa3af2e8728514d31da21
branch: main
author: larryhastings <[email protected]>
committer: JelleZijlstra <[email protected]>
date: 2024-09-30T15:25:56-07:00
summary:

Minor edit for code clarification in annotationlib. (#124805)

files:
M Lib/annotationlib.py

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)

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to