summaryrefslogtreecommitdiff
path: root/Objects/bytesobject.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-09-18 21:42:35 +0000
committerBenjamin Peterson <benjamin@python.org>2009-09-18 21:42:35 +0000
commit15353151849ff5a24919d80eae1636f950346b05 (patch)
treec3ff2960c952903d0093822b2a9c41af9ec675e5 /Objects/bytesobject.c
parent20280921e21d33023c4a202914ea2c0bd8973374 (diff)
downloadcpython-15353151849ff5a24919d80eae1636f950346b05.tar.gz
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/bytesobject.c')
-rw-r--r--Objects/bytesobject.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index fb4a845b40..27d4f95f06 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -2725,12 +2725,13 @@ as well as any other name registerd with codecs.register_error that is\n\
able to handle UnicodeDecodeErrors.");
static PyObject *
-bytes_decode(PyObject *self, PyObject *args)
+bytes_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();
@@ -2831,7 +2832,7 @@ bytes_methods[] = {
_Py_capitalize__doc__},
{"center", (PyCFunction)stringlib_center, METH_VARARGS, center__doc__},
{"count", (PyCFunction)bytes_count, METH_VARARGS, count__doc__},
- {"decode", (PyCFunction)bytes_decode, METH_VARARGS, decode__doc__},
+ {"decode", (PyCFunction)bytes_decode, METH_VARARGS | METH_KEYWORDS, decode__doc__},
{"endswith", (PyCFunction)bytes_endswith, METH_VARARGS,
endswith__doc__},
{"expandtabs", (PyCFunction)stringlib_expandtabs, METH_VARARGS,