(exc)
| 1149 | data.decode(encoding, "test.replacing") |
| 1150 | |
| 1151 | def mutating(exc): |
| 1152 | if isinstance(exc, UnicodeDecodeError): |
| 1153 | exc.object = b"" |
| 1154 | return ("\u4242", 0) |
| 1155 | else: |
| 1156 | raise TypeError("don't know how to handle %r" % exc) |
| 1157 | codecs.register_error("test.mutating", mutating) |
| 1158 | # If the decoder doesn't pick up the modified input the following |
| 1159 | # will lead to an endless loop |