Skip to content

Commit 4849b07

Browse files
authored
[_io] Limit io.text_encoding argument to str | None (#15663)
1 parent 0ea2915 commit 4849b07

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stdlib/_io.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ from types import TracebackType
99
from typing import IO, Any, BinaryIO, Final, Generic, Literal, Protocol, TextIO, TypeVar, overload, type_check_only
1010
from typing_extensions import Self, disjoint_base
1111

12-
_T = TypeVar("_T")
12+
_S = TypeVar("_S", bound=str)
1313

1414
if sys.version_info >= (3, 14):
1515
DEFAULT_BUFFER_SIZE: Final = 131072
@@ -298,4 +298,4 @@ if sys.version_info >= (3, 10):
298298
@overload
299299
def text_encoding(encoding: None, stacklevel: int = 2, /) -> Literal["locale", "utf-8"]: ...
300300
@overload
301-
def text_encoding(encoding: _T, stacklevel: int = 2, /) -> _T: ...
301+
def text_encoding(encoding: _S, stacklevel: int = 2, /) -> _S: ...

0 commit comments

Comments
 (0)