Discussion:
[Python-3000-checkins] r65760 - in python/branches/py3k: Misc/NEWS Modules/cjkcodecs/multibytecodec.c
hirokazu.yamamoto
2008-08-17 12:59:58 UTC
Permalink
Author: hirokazu.yamamoto
Date: Sun Aug 17 14:59:57 2008
New Revision: 65760

Log:
Issue #3575: Incremental decoder's decode function now takes bytearray
by using 's*' instead of 't#'

Modified:
python/branches/py3k/Misc/NEWS
python/branches/py3k/Modules/cjkcodecs/multibytecodec.c

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Sun Aug 17 14:59:57 2008
@@ -30,6 +30,9 @@
Library
-------

+- Issue #3575: Incremental decoder's decode function now takes bytearray
+ by using 's*' instead of 't#'.
+
- Issue #2222: Fixed reference leak when occured os.rename()
fails unicode conversion on 2nd parameter. (windows only)


Modified: python/branches/py3k/Modules/cjkcodecs/multibytecodec.c
==============================================================================
--- python/branches/py3k/Modules/cjkcodecs/multibytecodec.c (original)
+++ python/branches/py3k/Modules/cjkcodecs/multibytecodec.c Sun Aug 17 14:59:57 2008
@@ -1034,12 +1034,15 @@
{
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 @@
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);

Loading...