Skip to content

Commit c39b224

Browse files
authored
Fixes
1 parent e7f3c7b commit c39b224

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

stdlib/typing_extensions.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

206207
class _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
454455
else:
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

465466
if sys.version_info >= (3, 13):
466467
from types import CapsuleType as CapsuleType

0 commit comments

Comments
 (0)