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

Unified Diff: Objects/stringlib/find.h

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/bytesobject.c ('k') | Objects/unicodeobject.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Objects/stringlib/find.h Sun Feb 26 18:09:50 2012 +0100
+++ b/Objects/stringlib/find.h Sun Feb 26 20:28:46 2012 +0100
@@ -103,8 +103,8 @@
Py_LOCAL_INLINE(int)
STRINGLIB(parse_args_finds)(const char * function_name, PyObject *args,
- PyObject **subobj,
- Py_ssize_t *start, Py_ssize_t *end)
+ PyObject *kwds, PyObject **subobj,
+ Py_ssize_t *start, Py_ssize_t *end)
{
PyObject *tmp_subobj;
Py_ssize_t tmp_start = 0;
@@ -112,11 +112,13 @@
PyObject *obj_start=Py_None, *obj_end=Py_None;
char format[FORMAT_BUFFER_SIZE] = "O|OO:";
size_t len = strlen(format);
+ static char *kwlist[] = {"sub", "start", "end", 0};
strncpy(format + len, function_name, FORMAT_BUFFER_SIZE - len - 1);
format[FORMAT_BUFFER_SIZE - 1] = '\0';
- if (!PyArg_ParseTuple(args, format, &tmp_subobj, &obj_start, &obj_end))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, format, kwlist, &tmp_subobj,
+ &obj_start, &obj_end))
return 0;
/* To support None in "start" and "end" arguments, meaning
@@ -151,12 +153,12 @@
Py_LOCAL_INLINE(int)
STRINGLIB(parse_args_finds_unicode)(const char * function_name, PyObject *args,
- PyObject **substring,
- Py_ssize_t *start, Py_ssize_t *end)
+ PyObject *kwds, PyObject **substring,
+ Py_ssize_t *start, Py_ssize_t *end)
{
PyObject *tmp_substring;
- if(STRINGLIB(parse_args_finds)(function_name, args, &tmp_substring,
+ if(STRINGLIB(parse_args_finds)(function_name, args, kwds, &tmp_substring,
start, end)) {
tmp_substring = PyUnicode_FromObject(tmp_substring);
if (!tmp_substring)
@@ -181,14 +183,14 @@
Py_LOCAL_INLINE(int)
STRINGLIB(parse_args_finds_byte)(const char *function_name, PyObject *args,
- PyObject **subobj, char *byte,
+ PyObject *kwds, PyObject **subobj, char *byte,
Py_ssize_t *start, Py_ssize_t *end)
{
PyObject *tmp_subobj;
Py_ssize_t ival;
PyObject *err;
- if(!STRINGLIB(parse_args_finds)(function_name, args, &tmp_subobj,
+ if(!STRINGLIB(parse_args_finds)(function_name, args, kwds, &tmp_subobj,
start, end))
return 0;
« no previous file with comments | « Objects/bytesobject.c ('k') | Objects/unicodeobject.c » ('j') | no next file with comments »

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