From 1d336af2ddb2abfb08923350daad81f10cb9fde6 Mon Sep 17 00:00:00 2001 From: donbarbos Date: Fri, 9 Jan 2026 12:40:45 +0400 Subject: [PATCH] [fileinput] Deprecate hook_encoded Docs: https://docs.python.org/dev/library/fileinput.html#fileinput.hook_encoded --- stdlib/fileinput.pyi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stdlib/fileinput.pyi b/stdlib/fileinput.pyi index 910d63814275..6778b764810b 100644 --- a/stdlib/fileinput.pyi +++ b/stdlib/fileinput.pyi @@ -3,7 +3,7 @@ from _typeshed import AnyStr_co, StrOrBytesPath from collections.abc import Callable, Iterable from types import GenericAlias, TracebackType from typing import IO, Any, AnyStr, Generic, Literal, Protocol, overload, type_check_only -from typing_extensions import Self, TypeAlias +from typing_extensions import Self, TypeAlias, deprecated __all__ = [ "input", @@ -207,4 +207,9 @@ if sys.version_info >= (3, 10): else: def hook_compressed(filename: StrOrBytesPath, mode: str) -> IO[Any]: ... -def hook_encoded(encoding: str, errors: str | None = None) -> Callable[[StrOrBytesPath, str], IO[Any]]: ... +if sys.version_info >= (3, 10): + @deprecated("Deprecated since Python 3.10. Use `fileinput.input` or `fileinput.FileInput` instead.") + def hook_encoded(encoding: str, errors: str | None = None) -> Callable[[StrOrBytesPath, str], IO[Any]]: ... + +else: + def hook_encoded(encoding: str, errors: str | None = None) -> Callable[[StrOrBytesPath, str], IO[Any]]: ...