diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-09-18 21:46:21 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-09-18 21:46:21 (GMT) |
commit | dc782b55f2c7ede13c8c2bbc76662e8a9784d20c (patch) | |
tree | 239b0ddea738d13ce6d6e5ad0e82eaf0f4007c8d /Objects | |
parent | 579a358e61292774a9ab57fe7e92441777e48be4 (diff) | |
download | cpython-dc782b55f2c7ede13c8c2bbc76662e8a9784d20c.zip cpython-dc782b55f2c7ede13c8c2bbc76662e8a9784d20c.tar.gz cpython-dc782b55f2c7ede13c8c2bbc76662e8a9784d20c.tar.bz2 |
backport keyword argument support for bytearray.decode
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bytearrayobject.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index b183cc1..0390c1d 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -2942,12 +2942,13 @@ as well as any other name registered with codecs.register_error that is\n\ able to handle UnicodeDecodeErrors."); static PyObject * -bytearray_decode(PyObject *self, PyObject *args) +bytearray_decode(PyObject *self, PyObject *args, PyObject *kwargs) { const char *encoding = NULL; const char *errors = NULL; + static char *kwlist[] = {"encoding", "errors", 0}; - if (!PyArg_ParseTuple(args, "|ss:decode", &encoding, &errors)) + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ss:decode", kwlist, &encoding, &errors)) return NULL; if (encoding == NULL) { #ifdef Py_USING_UNICODE @@ -3189,7 +3190,7 @@ bytearray_methods[] = { _Py_capitalize__doc__}, {"center", (PyCFunction)stringlib_center, METH_VARARGS, center__doc__}, {"count", (PyCFunction)bytearray_count, METH_VARARGS, count__doc__}, - {"decode", (PyCFunction)bytearray_decode, METH_VARARGS, decode_doc}, + {"decode", (PyCFunction)bytearray_decode, METH_VARARGS | METH_KEYWORDS, decode_doc}, {"endswith", (PyCFunction)bytearray_endswith, METH_VARARGS, endswith__doc__}, {"expandtabs", (PyCFunction)stringlib_expandtabs, METH_VARARGS, expandtabs__doc__}, |