diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-09-18 21:42:35 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-09-18 21:42:35 (GMT) |
commit | 308d637c94b9ed88c386b83891ad38b2131ebd12 (patch) | |
tree | da0e7c3d9999e3c0a3dbc02fb4be7fbffba5ed7e /Objects/bytearrayobject.c | |
parent | 7a4e5866f70ccbb76dae6e0139f5ddba8bc5761a (diff) | |
download | cpython-308d637c94b9ed88c386b83891ad38b2131ebd12.zip cpython-308d637c94b9ed88c386b83891ad38b2131ebd12.tar.gz cpython-308d637c94b9ed88c386b83891ad38b2131ebd12.tar.bz2 |
Merged revisions 74929 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74929 | benjamin.peterson | 2009-09-18 16:14:55 -0500 (Fri, 18 Sep 2009) | 1 line
add keyword arguments support to str/unicode encode and decode #6300
........
Diffstat (limited to 'Objects/bytearrayobject.c')
-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 835244a..c09ccde 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -2877,12 +2877,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) encoding = PyUnicode_GetDefaultEncoding(); @@ -3112,7 +3113,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__}, |