From 243393d04668bad278418ff791026e72a95a922b Mon Sep 17 00:00:00 2001 From: e1turin Date: Fri, 13 Feb 2026 22:12:11 +0300 Subject: [PATCH 1/2] Correctly mark the error case in example of protocol implementation for class object --- docs/spec/protocol.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/spec/protocol.rst b/docs/spec/protocol.rst index 2803da0a..d5735a0c 100644 --- a/docs/spec/protocol.rst +++ b/docs/spec/protocol.rst @@ -509,8 +509,8 @@ For example:: class C: def meth(self, x: int) -> int: ... - a: ProtoA = C # Type check error, signatures don't match! - b: ProtoB = C # OK + a: ProtoA = C() # OK + b: ProtoB = C() # Error: signatures don't match .. _`protocol-newtype-aliases`: From b3497a1a5144472ba16328424b4b94efe5ca3644 Mon Sep 17 00:00:00 2001 From: e1turin Date: Fri, 13 Feb 2026 22:12:33 +0300 Subject: [PATCH 2/2] Format code in common style in example of protocol implementation for class object --- docs/spec/protocol.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/spec/protocol.rst b/docs/spec/protocol.rst index d5735a0c..a7370b36 100644 --- a/docs/spec/protocol.rst +++ b/docs/spec/protocol.rst @@ -502,12 +502,15 @@ For example:: from typing import Any, Protocol class ProtoA(Protocol): - def meth(self, x: int) -> int: ... + def meth(self, x: int) -> int: + ... class ProtoB(Protocol): - def meth(self, obj: Any, x: int) -> int: ... + def meth(self, obj: Any, x: int) -> int: + ... class C: - def meth(self, x: int) -> int: ... + def meth(self, x: int) -> int: + ... a: ProtoA = C() # OK b: ProtoB = C() # Error: signatures don't match