bpo-31243: fix PyArg_ParseTuple failure checks by orenmn · Pull Request #3171 · python/cpython
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Similar changes should be made in DECODER_GETSTATE().
I think it is worth to keep the wrong type name in this error, since returning a bytearray or a memoryview is more common error. But it would be nice to keep it short and make all three error messages similar.
For example, just "illegal decoder state" for first two cases and "illegal decoder state: the first item should be a bytes object, not '%.200s'" in the third case.