| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| @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 |
There was a problem hiding this comment.
This is not correct for all codecs:
>>> codecs.lookup("ascii").decode(b"abc", errors="replace")
Traceback (most recent call last):
File "<python-input-3>", line 1, in <module>
codecs.lookup("ascii").decode(b"abc", errors="replace")
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: _codecs.ascii_decode() takes no keyword arguments
Sorry, something went wrong.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Fixes #16441.
The UTF-8 decoder returned by codecs.lookup() accepts errors= as a keyword. Other codecs keep a positional-only signature because some reject keyword arguments.