mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-132493: Support deferred annotations in Protocols (#132494)
This commit is contained in:
parent
818b6a9ead
commit
666eeda13d
3 changed files with 14 additions and 1 deletions
|
@ -1801,7 +1801,9 @@ def _get_protocol_attrs(cls):
|
|||
for base in cls.__mro__[:-1]: # without object
|
||||
if base.__name__ in {'Protocol', 'Generic'}:
|
||||
continue
|
||||
annotations = getattr(base, '__annotations__', {})
|
||||
annotations = _lazy_annotationlib.get_annotations(
|
||||
base, format=_lazy_annotationlib.Format.FORWARDREF
|
||||
)
|
||||
for attr in (*base.__dict__, *annotations):
|
||||
if not attr.startswith('_abc_') and attr not in EXCLUDED_ATTRIBUTES:
|
||||
attrs.add(attr)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue