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

Unified Diff: Objects/unicodeobject.c

Issue 8706: accept keyword arguments on all base type methods and builtins
Patch Set: Created 8 years, 3 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
« no previous file with comments | « Objects/stringlib/find.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Objects/unicodeobject.c Sun Feb 26 18:09:50 2012 +0100
+++ b/Objects/unicodeobject.c Sun Feb 26 20:28:46 2012 +0100
@@ -11080,7 +11080,7 @@
interpreted as in slice notation.");
static PyObject *
-unicode_count(PyObject *self, PyObject *args)
+unicode_count(PyObject *self, PyObject *args, PyObject *kwds)
{
PyObject *substring;
Py_ssize_t start = 0;
@@ -11090,7 +11090,7 @@
void *buf1, *buf2;
Py_ssize_t len1, len2, iresult;
- if (!stringlib_parse_args_finds_unicode("count", args, &substring,
+ if (!stringlib_parse_args_finds_unicode("count", args, kwds, &substring,
&start, &end))
return NULL;
@@ -11271,14 +11271,14 @@
Return -1 on failure.");
static PyObject *
-unicode_find(PyObject *self, PyObject *args)
+unicode_find(PyObject *self, PyObject *args, PyObject *kwds)
{
PyObject *substring;
Py_ssize_t start;
Py_ssize_t end;
Py_ssize_t result;
- if (!stringlib_parse_args_finds_unicode("find", args, &substring,
+ if (!stringlib_parse_args_finds_unicode("find", args, kwds, &substring,
&start, &end))
return NULL;
@@ -11372,14 +11372,14 @@
Like S.find() but raise ValueError when the substring is not found.");
static PyObject *
-unicode_index(PyObject *self, PyObject *args)
+unicode_index(PyObject *self, PyObject *args, PyObject *kwds)
{
Py_ssize_t result;
PyObject *substring;
Py_ssize_t start;
Py_ssize_t end;
- if (!stringlib_parse_args_finds_unicode("index", args, &substring,
+ if (!stringlib_parse_args_finds_unicode("index", args, kwds, &substring,
&start, &end))
return NULL;
@@ -12388,14 +12388,14 @@
Return -1 on failure.");
static PyObject *
-unicode_rfind(PyObject *self, PyObject *args)
+unicode_rfind(PyObject *self, PyObject *args, PyObject *kwds)
{
PyObject *substring;
Py_ssize_t start;
Py_ssize_t end;
Py_ssize_t result;
- if (!stringlib_parse_args_finds_unicode("rfind", args, &substring,
+ if (!stringlib_parse_args_finds_unicode("rfind", args, kwds, &substring,
&start, &end))
return NULL;
@@ -12420,14 +12420,14 @@
Like S.rfind() but raise ValueError when the substring is not found.");
static PyObject *
-unicode_rindex(PyObject *self, PyObject *args)
+unicode_rindex(PyObject *self, PyObject *args, PyObject *kwds)
{
PyObject *substring;
Py_ssize_t start;
Py_ssize_t end;
Py_ssize_t result;
- if (!stringlib_parse_args_finds_unicode("rindex", args, &substring,
+ if (!stringlib_parse_args_finds_unicode("rindex", args, kwds, &substring,
&start, &end))
return NULL;
@@ -13004,8 +13004,7 @@
prefix can also be a tuple of strings to try.");
static PyObject *
-unicode_startswith(PyObject *self,
- PyObject *args)
+unicode_startswith(PyObject *self, PyObject *args, PyObject *kwds)
{
PyObject *subobj;
PyObject *substring;
@@ -13013,7 +13012,8 @@
Py_ssize_t end = PY_SSIZE_T_MAX;
int result;
- if (!stringlib_parse_args_finds("startswith", args, &subobj, &start, &end))
+ if (!stringlib_parse_args_finds("startswith", args, kwds, &subobj, &start,
+ &end))
return NULL;
if (PyTuple_Check(subobj)) {
Py_ssize_t i;
@@ -13052,8 +13052,7 @@
suffix can also be a tuple of strings to try.");
static PyObject *
-unicode_endswith(PyObject *self,
- PyObject *args)
+unicode_endswith(PyObject *self, PyObject *args, PyObject *kwds)
{
PyObject *subobj;
PyObject *substring;
@@ -13061,7 +13060,8 @@
Py_ssize_t end = PY_SSIZE_T_MAX;
int result;
- if (!stringlib_parse_args_finds("endswith", args, &subobj, &start, &end))
+ if (!stringlib_parse_args_finds("endswith", args, kwds, &subobj, &start,
+ &end))
return NULL;
if (PyTuple_Check(subobj)) {
Py_ssize_t i;
@@ -13178,16 +13178,16 @@
{"casefold", (PyCFunction) unicode_casefold, METH_NOARGS, casefold__doc__},
{"title", (PyCFunction) unicode_title, METH_NOARGS, title__doc__},
{"center", (PyCFunction) unicode_center, METH_VARARGS, center__doc__},
- {"count", (PyCFunction) unicode_count, METH_VARARGS, count__doc__},
+ {"count", (PyCFunction) unicode_count, METH_VARARGS | METH_KEYWORDS, count__doc__},
{"expandtabs", (PyCFunction) unicode_expandtabs, METH_VARARGS, expandtabs__doc__},
- {"find", (PyCFunction) unicode_find, METH_VARARGS, find__doc__},
+ {"find", (PyCFunction) unicode_find, METH_VARARGS | METH_KEYWORDS, find__doc__},
{"partition", (PyCFunction) unicode_partition, METH_O, partition__doc__},
- {"index", (PyCFunction) unicode_index, METH_VARARGS, index__doc__},
+ {"index", (PyCFunction) unicode_index, METH_VARARGS | METH_KEYWORDS, index__doc__},
{"ljust", (PyCFunction) unicode_ljust, METH_VARARGS, ljust__doc__},
{"lower", (PyCFunction) unicode_lower, METH_NOARGS, lower__doc__},
{"lstrip", (PyCFunction) unicode_lstrip, METH_VARARGS, lstrip__doc__},
- {"rfind", (PyCFunction) unicode_rfind, METH_VARARGS, rfind__doc__},
- {"rindex", (PyCFunction) unicode_rindex, METH_VARARGS, rindex__doc__},
+ {"rfind", (PyCFunction) unicode_rfind, METH_VARARGS | METH_KEYWORDS, rfind__doc__},
+ {"rindex", (PyCFunction) unicode_rindex, METH_VARARGS | METH_KEYWORDS, rindex__doc__},
{"rjust", (PyCFunction) unicode_rjust, METH_VARARGS, rjust__doc__},
{"rstrip", (PyCFunction) unicode_rstrip, METH_VARARGS, rstrip__doc__},
{"rpartition", (PyCFunction) unicode_rpartition, METH_O, rpartition__doc__},
@@ -13196,8 +13196,8 @@
{"swapcase", (PyCFunction) unicode_swapcase, METH_NOARGS, swapcase__doc__},
{"translate", (PyCFunction) unicode_translate, METH_O, translate__doc__},
{"upper", (PyCFunction) unicode_upper, METH_NOARGS, upper__doc__},
- {"startswith", (PyCFunction) unicode_startswith, METH_VARARGS, startswith__doc__},
- {"endswith", (PyCFunction) unicode_endswith, METH_VARARGS, endswith__doc__},
+ {"startswith", (PyCFunction) unicode_startswith, METH_VARARGS | METH_KEYWORDS, startswith__doc__},
+ {"endswith", (PyCFunction) unicode_endswith, METH_VARARGS | METH_KEYWORDS, endswith__doc__},
{"islower", (PyCFunction) unicode_islower, METH_NOARGS, islower__doc__},
{"isupper", (PyCFunction) unicode_isupper, METH_NOARGS, isupper__doc__},
{"istitle", (PyCFunction) unicode_istitle, METH_NOARGS, istitle__doc__},
« no previous file with comments | « Objects/stringlib/find.h ('k') | no next file » | no next file with comments »

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