@@ -202,6 +202,7 @@ _T = _TypeVar("_T")
202202_F = _TypeVar ("_F" , bound = Callable [..., Any ])
203203_TC = _TypeVar ("_TC" , bound = type [object ])
204204_T_co = _TypeVar ("_T_co" , covariant = True ) # Any type covariant containers.
205+ _T_contra = _TypeVar ("_T_contra" , contravariant = True )
205206
206207class _Final : ... # This should be imported from typing but that breaks pytype
207208
@@ -453,14 +454,14 @@ if sys.version_info >= (3, 14):
453454 from io import Reader as Reader , Writer as Writer
454455else :
455456 @runtime_checkable
456- class Reader (Protocol_ [ T_co ]):
457+ class Reader (Protocol [ _T_co ]):
457458 @abc .abstractmethod
458- def read (self , size : int = ..., / ) -> T_co : ...
459+ def read (self , size : int = ..., / ) -> _T_co : ...
459460
460461 @runtime_checkable
461462 class Writer (Protocol [_T_contra ]):
462463 @abc .abstractmethod
463- def write (self , data : T_contra , / ) -> int : ...
464+ def write (self , data : _T_contra , / ) -> int : ...
464465
465466if sys .version_info >= (3 , 13 ):
466467 from types import CapsuleType as CapsuleType
0 commit comments