diff --git a/stdlib/@tests/test_cases/check_codecs.py b/stdlib/@tests/test_cases/check_codecs.py index 19e663ceeaaf..76411fa6dc50 100644 --- a/stdlib/@tests/test_cases/check_codecs.py +++ b/stdlib/@tests/test_cases/check_codecs.py @@ -7,6 +7,7 @@ assert_type(codecs.decode(b"x", "unicode-escape"), str) assert_type(codecs.decode(b"x", "utf-8"), str) +assert_type(codecs.lookup("UTF-8").decode(b"potato", errors="replace"), tuple[str, int]) codecs.decode("x", "utf-8") # type: ignore assert_type(codecs.decode("ab", "hex"), bytes) diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index ee1ab25bac47..94a1fdd25577 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -101,7 +101,7 @@ class _Encoder(Protocol): @type_check_only class _Decoder(Protocol): - def __call__(self, input: ReadableBuffer, errors: str = ..., /) -> tuple[str, int]: ... # signature of Codec().decode + def __call__(self, input: ReadableBuffer, /, errors: str = ...) -> tuple[str, int]: ... # signature of Codec().decode @type_check_only class _StreamReader(Protocol):