Mercurial > cpython-lru_cache-weakref
diff Modules/_codecsmodule.c @ 43933:9c4bf18e5d30
Merged revisions 59056-59076 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59064 | christian.heimes | 2007-11-20 02:48:48 +0100 (Tue, 20 Nov 2007) | 1 line
Fixed bug #1470
........
r59066 | martin.v.loewis | 2007-11-20 03:46:02 +0100 (Tue, 20 Nov 2007) | 2 lines
Patch #1468: Package Lib/test/*.pem.
........
r59068 | christian.heimes | 2007-11-20 04:21:02 +0100 (Tue, 20 Nov 2007) | 1 line
Another fix for test_shutil. Martin pointed out that it breaks some build bots
........
r59073 | nick.coghlan | 2007-11-20 15:55:57 +0100 (Tue, 20 Nov 2007) | 1 line
Backport some main.c cleanup from the py3k branch
........
r59076 | amaury.forgeotdarc | 2007-11-21 00:31:27 +0100 (Wed, 21 Nov 2007) | 6 lines
The incremental decoder for utf-7 must preserve its state between calls.
Solves issue1460.
Might not be a backport candidate: a new API function was added,
and some code may rely on details in utf-7.py.
........
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Tue, 20 Nov 2007 23:38:09 +0000 |
| parents | 0d462d789b18 |
| children | 23ab586c427a |
line wrap: on
line diff
--- a/Modules/_codecsmodule.c Tue Nov 20 22:52:30 2007 +0000 +++ b/Modules/_codecsmodule.c Tue Nov 20 23:38:09 2007 +0000 @@ -250,18 +250,25 @@ static PyObject * utf_7_decode(PyObject *self, - PyObject *args) + PyObject *args) { const char *data; Py_ssize_t size; const char *errors = NULL; + int final = 0; + Py_ssize_t consumed; + PyObject *decoded = NULL; - if (!PyArg_ParseTuple(args, "t#|z:utf_7_decode", - &data, &size, &errors)) - return NULL; + if (!PyArg_ParseTuple(args, "t#|zi:utf_7_decode", + &data, &size, &errors, &final)) + return NULL; + consumed = size; - return codec_tuple(PyUnicode_DecodeUTF7(data, size, errors), - size); + decoded = PyUnicode_DecodeUTF7Stateful(data, size, errors, + final ? NULL : &consumed); + if (decoded == NULL) + return NULL; + return codec_tuple(decoded, consumed); } static PyObject *
