summaryrefslogtreecommitdiffstats
path: root/Objects/stringlib
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-11-16 17:10:57 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-11-16 17:10:57 (GMT)
commit745d54d2fa1870bbb933579b390fdd1702874ead (patch)
tree9e0560c56181a5dea12bf970862db77dddba6afd /Objects/stringlib
parentb41c2547e0a5fa75d436d824e5f09f2327354e1a (diff)
downloadcpython-745d54d2fa1870bbb933579b390fdd1702874ead.zip
cpython-745d54d2fa1870bbb933579b390fdd1702874ead.tar.gz
cpython-745d54d2fa1870bbb933579b390fdd1702874ead.tar.bz2
#17806: Added keyword-argument support for "tabsize" to str/bytes.expandtabs().
Diffstat (limited to 'Objects/stringlib')
-rw-r--r--Objects/stringlib/transmogrify.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/Objects/stringlib/transmogrify.h b/Objects/stringlib/transmogrify.h
index 90fa129..dd00976 100644
--- a/Objects/stringlib/transmogrify.h
+++ b/Objects/stringlib/transmogrify.h
@@ -5,21 +5,23 @@
shared code in bytes_methods.c to cut down on duplicate code bloat. */
PyDoc_STRVAR(expandtabs__doc__,
-"B.expandtabs([tabsize]) -> copy of B\n\
+"B.expandtabs(tabsize=8) -> copy of B\n\
\n\
Return a copy of B where all tab characters are expanded using spaces.\n\
If tabsize is not given, a tab size of 8 characters is assumed.");
static PyObject*
-stringlib_expandtabs(PyObject *self, PyObject *args)
+stringlib_expandtabs(PyObject *self, PyObject *args, PyObject *kwds)
{
const char *e, *p;
char *q;
size_t i, j;
PyObject *u;
+ static char *kwlist[] = {"tabsize", 0};
int tabsize = 8;
- if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i:expandtabs",
+ kwlist, &tabsize))
return NULL;
/* First pass: determine size of output string */