summaryrefslogtreecommitdiffstats
path: root/Lib/typing.py
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2025-04-15 17:14:27 (GMT)
committerGitHub <noreply@github.com>2025-04-15 17:14:27 (GMT)
commit666eeda13d319aa82b151eef3e3c55a48d90a052 (patch)
tree7ae8857cde0fa13b86e1f4d101d8d6f731e60b37 /Lib/typing.py
parent818b6a9eadb7c606bc3faab91de4a76bde66a9ae (diff)
downloadcpython-666eeda13d319aa82b151eef3e3c55a48d90a052.zip
cpython-666eeda13d319aa82b151eef3e3c55a48d90a052.tar.gz
cpython-666eeda13d319aa82b151eef3e3c55a48d90a052.tar.bz2
gh-132493: Support deferred annotations in Protocols (#132494)
Diffstat (limited to 'Lib/typing.py')
-rw-r--r--Lib/typing.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/typing.py b/Lib/typing.py
index e5d14b0..08b2ba3 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -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)