summaryrefslogtreecommitdiffstats
path: root/Modules/cjkcodecs
diff options
context:
space:
mode:
authorHye-Shik Chang <hyeshik@gmail.com>2009-04-02 10:33:16 (GMT)
committerHye-Shik Chang <hyeshik@gmail.com>2009-04-02 10:33:16 (GMT)
commit944820b044ce3944dcef1b514e075118f6872942 (patch)
tree4bb9c95bc039e479a750d616bafa227fa9e64ff3 /Modules/cjkcodecs
parenta3d056ed95ff45dbd8abd90f3f816e7953214d80 (diff)
downloadcpython-944820b044ce3944dcef1b514e075118f6872942.zip
cpython-944820b044ce3944dcef1b514e075118f6872942.tar.gz
cpython-944820b044ce3944dcef1b514e075118f6872942.tar.bz2
Issue #5640: Fix _multibytecodec so that CJK codecs don't repeat
error replacement returned by codec error callbacks twice in IncrementalEncoder and StreamWriter.
Diffstat (limited to 'Modules/cjkcodecs')
-rw-r--r--Modules/cjkcodecs/multibytecodec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index 9846465..c6b3492 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -506,7 +506,6 @@ multibytecodec_encode(MultibyteCodec *codec,
outleft = (Py_ssize_t)(buf.outbuf_end - buf.outbuf);
r = codec->encode(state, codec->config, &buf.inbuf, inleft,
&buf.outbuf, outleft, flags);
- *data = buf.inbuf;
if ((r == 0) || (r == MBERR_TOOFEW && !(flags & MBENC_FLUSH)))
break;
else if (multibytecodec_encerror(codec, state, &buf, errors,r))
@@ -536,6 +535,7 @@ multibytecodec_encode(MultibyteCodec *codec,
if (_PyBytes_Resize(&buf.outobj, finalsize) == -1)
goto errorexit;
+ *data = buf.inbuf;
Py_XDECREF(buf.excobj);
return buf.outobj;