summaryrefslogtreecommitdiffstats
path: root/Modules/cjkcodecs
diff options
context:
space:
mode:
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2008-08-17 12:59:57 (GMT)
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2008-08-17 12:59:57 (GMT)
commit078f0f5a6d7dd44ad58b3a039ca1c34c5d9449b5 (patch)
treeac55931f55140c64d269f004267400dc35d58fb5 /Modules/cjkcodecs
parent289d9eb10f2af7d09c4a084a4340c3567d4cedc8 (diff)
downloadcpython-078f0f5a6d7dd44ad58b3a039ca1c34c5d9449b5.zip
cpython-078f0f5a6d7dd44ad58b3a039ca1c34c5d9449b5.tar.gz
cpython-078f0f5a6d7dd44ad58b3a039ca1c34c5d9449b5.tar.bz2
Issue #3575: Incremental decoder's decode function now takes bytearray
by using 's*' instead of 't#'
Diffstat (limited to 'Modules/cjkcodecs')
-rw-r--r--Modules/cjkcodecs/multibytecodec.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index 95b2278..67c25b1 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -1034,12 +1034,15 @@ mbidecoder_decode(MultibyteIncrementalDecoderObject *self,
{
MultibyteDecodeBuffer buf;
char *data, *wdata = NULL;
+ Py_buffer pdata;
Py_ssize_t wsize, finalsize = 0, size, origpending;
int final = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "t#|i:decode",
- incrementalkwarglist, &data, &size, &final))
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s*|i:decode",
+ incrementalkwarglist, &pdata, &final))
return NULL;
+ data = pdata.buf;
+ size = pdata.len;
buf.outobj = buf.excobj = NULL;
origpending = self->pendingsize;
@@ -1088,12 +1091,14 @@ mbidecoder_decode(MultibyteIncrementalDecoderObject *self,
if (PyUnicode_Resize(&buf.outobj, finalsize) == -1)
goto errorexit;
+ PyBuffer_Release(&pdata);
if (wdata != data)
PyMem_Del(wdata);
Py_XDECREF(buf.excobj);
return buf.outobj;
errorexit:
+ PyBuffer_Release(&pdata);
if (wdata != NULL && wdata != data)
PyMem_Del(wdata);
Py_XDECREF(buf.excobj);