diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-12-14 18:23:30 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-12-14 18:23:30 (GMT) |
commit | c8428d3dce850a54eb49298ceabf95fc3c00867d (patch) | |
tree | d8806d53b2d52b58aaf5f083197e2141d4a8b62f /Modules | |
parent | 999df780d1dffdfe1e1e14122e38df098ef6f1a5 (diff) | |
download | cpython-c8428d3dce850a54eb49298ceabf95fc3c00867d.zip cpython-c8428d3dce850a54eb49298ceabf95fc3c00867d.tar.gz cpython-c8428d3dce850a54eb49298ceabf95fc3c00867d.tar.bz2 |
Merged revisions 76836 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r76836 | antoine.pitrou | 2009-12-14 19:00:06 +0100 (lun., 14 déc. 2009) | 5 lines
Issue #4757: `zlib.compress` and other methods in the zlib module now
raise a TypeError when given an `str` object (rather than a `bytes`-like
object). Patch by Victor Stinner and Florent Xicluna.
........
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/zlibmodule.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index 6b818e5..2f2e214 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -107,7 +107,7 @@ PyZlib_compress(PyObject *self, PyObject *args) z_stream zst; /* require Python string object, optional 'level' arg */ - if (!PyArg_ParseTuple(args, "s*|i:compress", &pinput, &level)) + if (!PyArg_ParseTuple(args, "y*|i:compress", &pinput, &level)) return NULL; input = pinput.buf; length = pinput.len; @@ -190,7 +190,7 @@ PyZlib_decompress(PyObject *self, PyObject *args) Py_ssize_t r_strlen=DEFAULTALLOC; z_stream zst; - if (!PyArg_ParseTuple(args, "s*|in:decompress", + if (!PyArg_ParseTuple(args, "y*|in:decompress", &pinput, &wsize, &r_strlen)) return NULL; input = pinput.buf; @@ -402,7 +402,7 @@ PyZlib_objcompress(compobject *self, PyObject *args) Byte *input; unsigned long start_total_out; - if (!PyArg_ParseTuple(args, "s*:compress", &pinput)) + if (!PyArg_ParseTuple(args, "y*:compress", &pinput)) return NULL; input = pinput.buf; inplen = pinput.len; @@ -484,7 +484,7 @@ PyZlib_objdecompress(compobject *self, PyObject *args) Byte *input; unsigned long start_total_out; - if (!PyArg_ParseTuple(args, "s*|i:decompress", &pinput, + if (!PyArg_ParseTuple(args, "y*|i:decompress", &pinput, &max_length)) return NULL; input = pinput.buf; @@ -912,8 +912,8 @@ PyZlib_adler32(PyObject *self, PyObject *args) unsigned int adler32val = 1; /* adler32(0L, Z_NULL, 0) */ Py_buffer pbuf; - if (!PyArg_ParseTuple(args, "s*|I:adler32", &pbuf, &adler32val)) - return NULL; + if (!PyArg_ParseTuple(args, "y*|I:adler32", &pbuf, &adler32val)) + return NULL; /* Releasing the GIL for very small buffers is inefficient and may lower performance */ if (pbuf.len > 1024*5) { @@ -921,7 +921,7 @@ PyZlib_adler32(PyObject *self, PyObject *args) adler32val = adler32(adler32val, pbuf.buf, pbuf.len); Py_END_ALLOW_THREADS } else { - adler32val = adler32(adler32val, pbuf.buf, pbuf.len); + adler32val = adler32(adler32val, pbuf.buf, pbuf.len); } PyBuffer_Release(&pbuf); return PyLong_FromUnsignedLong(adler32val & 0xffffffffU); @@ -940,7 +940,7 @@ PyZlib_crc32(PyObject *self, PyObject *args) Py_buffer pbuf; int signed_val; - if (!PyArg_ParseTuple(args, "s*|I:crc32", &pbuf, &crc32val)) + if (!PyArg_ParseTuple(args, "y*|I:crc32", &pbuf, &crc32val)) return NULL; /* Releasing the GIL for very small buffers is inefficient and may lower performance */ |