diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-13 12:37:23 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-13 12:37:23 (GMT) |
commit | 21a663ea2829b6808dd6981904c393332d271f8e (patch) | |
tree | de7302e8c98b9b075236c6e52f006835d01562e2 /Objects/stringlib/find.h | |
parent | 131b8f8eee3498d5d334bde9671825bdfe0cf222 (diff) | |
download | cpython-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.h | 13 |
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; |