Skip to content

Commit 2e67ef8

Browse files
authored
[fileinput] Deprecate hook_encoded (#15240)
1 parent 41c18af commit 2e67ef8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

stdlib/fileinput.pyi

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from _typeshed import AnyStr_co, StrOrBytesPath
33
from collections.abc import Callable, Iterable
44
from types import GenericAlias, TracebackType
55
from typing import IO, Any, AnyStr, Generic, Literal, Protocol, overload, type_check_only
6-
from typing_extensions import Self, TypeAlias
6+
from typing_extensions import Self, TypeAlias, deprecated
77

88
__all__ = [
99
"input",
@@ -207,4 +207,9 @@ if sys.version_info >= (3, 10):
207207
else:
208208
def hook_compressed(filename: StrOrBytesPath, mode: str) -> IO[Any]: ...
209209

210-
def hook_encoded(encoding: str, errors: str | None = None) -> Callable[[StrOrBytesPath, str], IO[Any]]: ...
210+
if sys.version_info >= (3, 10):
211+
@deprecated("Deprecated since Python 3.10. Use `fileinput.input` or `fileinput.FileInput` instead.")
212+
def hook_encoded(encoding: str, errors: str | None = None) -> Callable[[StrOrBytesPath, str], IO[Any]]: ...
213+
214+
else:
215+
def hook_encoded(encoding: str, errors: str | None = None) -> Callable[[StrOrBytesPath, str], IO[Any]]: ...

0 commit comments

Comments
 (0)