Skip to content

Commit 9db1a8b

Browse files
author
Victor Stinner
committed
Replace PyUnicodeObject* by PyObject* where it was irrevelant
A Unicode string can now be a PyASCIIObject, PyCompactUnicodeObject or PyUnicodeObject. Aliasing a PyASCIIObject* or PyCompactUnicodeObject* to PyUnicodeObject* is wrong
1 parent 0d60e87 commit 9db1a8b

3 files changed

Lines changed: 131 additions & 144 deletions

File tree

Include/unicodeobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1828,7 +1828,7 @@ PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject *s);
18281828
#ifndef Py_LIMITED_API
18291829
/* Externally visible for str.strip(unicode) */
18301830
PyAPI_FUNC(PyObject *) _PyUnicode_XStrip(
1831-
PyUnicodeObject *self,
1831+
PyObject *self,
18321832
int striptype,
18331833
PyObject *sepobj
18341834
);

Objects/stringlib/find.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ This function is a helper for the "find" family (find, rfind, index,
9595
rindex) and for count, startswith and endswith, because they all have
9696
the same behaviour for the arguments.
9797
98-
It does not touch the variables received until it knows everything
98+
It does not touch the variables received until it knows everything
9999
is ok.
100100
*/
101101

@@ -145,13 +145,13 @@ first argument is a unicode object.
145145
146146
Note that we receive a pointer to the pointer of the substring object,
147147
so when we create that object in this function we don't DECREF it,
148-
because it continues living in the caller functions (those functions,
148+
because it continues living in the caller functions (those functions,
149149
after finishing using the substring, must DECREF it).
150150
*/
151151

152152
Py_LOCAL_INLINE(int)
153153
STRINGLIB(parse_args_finds_unicode)(const char * function_name, PyObject *args,
154-
PyUnicodeObject **substring,
154+
PyObject **substring,
155155
Py_ssize_t *start, Py_ssize_t *end)
156156
{
157157
PyObject *tmp_substring;
@@ -161,7 +161,7 @@ STRINGLIB(parse_args_finds_unicode)(const char * function_name, PyObject *args,
161161
tmp_substring = PyUnicode_FromObject(tmp_substring);
162162
if (!tmp_substring)
163163
return 0;
164-
*substring = (PyUnicodeObject *)tmp_substring;
164+
*substring = tmp_substring;
165165
return 1;
166166
}
167167
return 0;

0 commit comments

Comments
 (0)