mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-124206: Fix calling get_annotate_function() on static types (#124208)
Fixes #124206. No news entry because the bug this fixes was never released.
This commit is contained in:
parent
3b6bfa77aa
commit
96f619faa7
3 changed files with 45 additions and 1 deletions
|
@ -575,7 +575,11 @@ def get_annotate_function(obj):
|
|||
Returns the __annotate__ function or None.
|
||||
"""
|
||||
if isinstance(obj, type):
|
||||
return _BASE_GET_ANNOTATE(obj)
|
||||
try:
|
||||
return _BASE_GET_ANNOTATE(obj)
|
||||
except AttributeError:
|
||||
# AttributeError is raised for static types.
|
||||
return None
|
||||
return getattr(obj, "__annotate__", None)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue