This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author doerwalter
Recipients amaury.forgeotdarc, doerwalter, ezio.melotti, vstinner
Date 2012-11-29.16:48:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1354207691.28.0.489514113498.issue16577@psf.upfronthosting.co.za>
In-reply-to
Content
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::

   import codecs

   def mutating(exc):
      if isinstance(exc, UnicodeDecodeError):
         exc.object[:] = b""
         return ("\u4242", 0)
      else:
         raise TypeError("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

So the change should indeed be reverted.
History
Date User Action Args
2012-11-29 16:48:11doerwaltersetrecipients: + doerwalter, amaury.forgeotdarc, vstinner, ezio.melotti
2012-11-29 16:48:11doerwaltersetmessageid: <1354207691.28.0.489514113498.issue16577@psf.upfronthosting.co.za>
2012-11-29 16:48:11doerwalterlinkissue16577 messages
2012-11-29 16:48:10doerwaltercreate