summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2024-06-11 13:06:49 (GMT)
committerGitHub <noreply@github.com>2024-06-11 13:06:49 (GMT)
commit9b8611eeea172cd4aa626ccd1ca333dc4093cd8c (patch)
tree93491345df33ac20e4c4e87f226ff7a7e781e465 /Lib/inspect.py
parent02c1dfff073a3dd6ce34a11b038defde291c2203 (diff)
downloadcpython-9b8611eeea172cd4aa626ccd1ca333dc4093cd8c.zip
cpython-9b8611eeea172cd4aa626ccd1ca333dc4093cd8c.tar.gz
cpython-9b8611eeea172cd4aa626ccd1ca333dc4093cd8c.tar.bz2
gh-119180: PEP 649 compiler changes (#119361)
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py8
1 files changed, 1 insertions, 7 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 2b7f8be..5570a43 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -220,13 +220,7 @@ def get_annotations(obj, *, globals=None, locals=None, eval_str=False):
"""
if isinstance(obj, type):
# class
- obj_dict = getattr(obj, '__dict__', None)
- if obj_dict and hasattr(obj_dict, 'get'):
- ann = obj_dict.get('__annotations__', None)
- if isinstance(ann, types.GetSetDescriptorType):
- ann = None
- else:
- ann = None
+ ann = obj.__annotations__
obj_globals = None
module_name = getattr(obj, '__module__', None)