You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
True, the second test uses the wrong error handler.
And yes, you're correct, bytes are now immutable. And even if I try to decode a bytearray, what the callback gets to see is still an immutable bytes object::
importcodecsdefmutating(exc):
ifisinstance(exc, UnicodeDecodeError):
exc.object[:] =b""return ("\u4242", 0)
else:
raiseTypeError("don't know how to handle %r"%exc)
codecs.register_error('mutating', mutating)
input=bytearray(b'bbb\xff')
input.decode('ascii', 'mutating')
This still raises:
TypeError: 'bytes' object does not support item assignment
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: