summaryrefslogtreecommitdiffstats
path: root/Objects/stringlib/find.h
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-04-13 12:37:23 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-04-13 12:37:23 (GMT)
commit21a663ea2829b6808dd6981904c393332d271f8e (patch)
treede7302e8c98b9b075236c6e52f006835d01562e2 /Objects/stringlib/find.h
parent131b8f8eee3498d5d334bde9671825bdfe0cf222 (diff)
downloadcpython-21a663ea2829b6808dd6981904c393332d271f8e.zip
cpython-21a663ea2829b6808dd6981904c393332d271f8e.tar.gz
cpython-21a663ea2829b6808dd6981904c393332d271f8e.tar.bz2
Issue #26057: Got rid of nonneeded use of PyUnicode_FromObject().
Diffstat (limited to 'Objects/stringlib/find.h')
-rw-r--r--Objects/stringlib/find.h13
1 files changed, 2 insertions, 11 deletions
diff --git a/Objects/stringlib/find.h b/Objects/stringlib/find.h
index 14815f6..a7065fc 100644
--- a/Objects/stringlib/find.h
+++ b/Objects/stringlib/find.h
@@ -123,11 +123,6 @@ STRINGLIB(parse_args_finds)(const char * function_name, PyObject *args,
/*
Wraps stringlib_parse_args_finds() and additionally ensures that the
first argument is a unicode object.
-
-Note that we receive a pointer to the pointer of the substring object,
-so when we create that object in this function we don't DECREF it,
-because it continues living in the caller functions (those functions,
-after finishing using the substring, must DECREF it).
*/
Py_LOCAL_INLINE(int)
@@ -135,14 +130,10 @@ STRINGLIB(parse_args_finds_unicode)(const char * function_name, PyObject *args,
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, substring,
start, end)) {
- tmp_substring = PyUnicode_FromObject(tmp_substring);
- if (!tmp_substring)
+ if (ensure_unicode(*substring) < 0)
return 0;
- *substring = tmp_substring;
return 1;
}
return 0;