Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(169612)

Unified Diff: Modules/_codecsmodule.c

Issue 23001: Accept mutable bytes-like objects
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
--- a/Modules/_codecsmodule.c Wed Mar 18 21:36:23 2015 -0500
+++ b/Modules/_codecsmodule.c Thu Mar 19 13:16:44 2015 +0200
@@ -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 *

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+