mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #23001: Few functions in modules mmap, ossaudiodev, socket, ssl, and
codecs, that accepted only read-only bytes-like object now accept writable bytes-like object too.
This commit is contained in:
parent
0eac13052c
commit
8490f5acfe
14 changed files with 196 additions and 104 deletions
|
@ -208,15 +208,18 @@ static PyObject *
|
|||
escape_decode(PyObject *self,
|
||||
PyObject *args)
|
||||
{
|
||||
Py_buffer pbuf;
|
||||
const char *errors = NULL;
|
||||
const char *data;
|
||||
Py_ssize_t size;
|
||||
PyObject *result;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "s#|z:escape_decode",
|
||||
&data, &size, &errors))
|
||||
if (!PyArg_ParseTuple(args, "s*|z:escape_decode",
|
||||
&pbuf, &errors))
|
||||
return NULL;
|
||||
return codec_tuple(PyBytes_DecodeEscape(data, size, errors, 0, NULL),
|
||||
size);
|
||||
result = codec_tuple(
|
||||
PyBytes_DecodeEscape(pbuf.buf, pbuf.len, errors, 0, NULL),
|
||||
pbuf.len);
|
||||
PyBuffer_Release(&pbuf);
|
||||
return result;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue