Commit 7931d9a9 authored by Victor Stinner's avatar Victor Stinner

Replace PyUnicodeObject type by PyObject

 * _PyUnicode_CheckConsistency() now takes a PyObject* instead of void*
 * Remove now useless casts to PyObject*
parent 76a31a6b
...@@ -2000,9 +2000,8 @@ PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy( ...@@ -2000,9 +2000,8 @@ PyAPI_FUNC(Py_UNICODE*) PyUnicode_AsUnicodeCopy(
#endif /* Py_LIMITED_API */ #endif /* Py_LIMITED_API */
#if defined(Py_DEBUG) && !defined(Py_LIMITED_API) #if defined(Py_DEBUG) && !defined(Py_LIMITED_API)
/* FIXME: use PyObject* type for op */
PyAPI_FUNC(int) _PyUnicode_CheckConsistency( PyAPI_FUNC(int) _PyUnicode_CheckConsistency(
void *op, PyObject *op,
int check_content); int check_content);
#endif #endif
......
...@@ -528,7 +528,7 @@ render_field(PyObject *fieldobj, SubString *format_spec, _PyAccu *acc) ...@@ -528,7 +528,7 @@ render_field(PyObject *fieldobj, SubString *format_spec, _PyAccu *acc)
PyObject *result = NULL; PyObject *result = NULL;
PyObject *format_spec_object = NULL; PyObject *format_spec_object = NULL;
PyObject *(*formatter)(PyObject *, PyObject *, Py_ssize_t, Py_ssize_t) = NULL; PyObject *(*formatter)(PyObject *, PyObject *, Py_ssize_t, Py_ssize_t) = NULL;
/* If we know the type exactly, skip the lookup of __format__ and just /* If we know the type exactly, skip the lookup of __format__ and just
call the formatter directly. */ call the formatter directly. */
if (PyUnicode_CheckExact(fieldobj)) if (PyUnicode_CheckExact(fieldobj))
...@@ -654,7 +654,7 @@ typedef struct { ...@@ -654,7 +654,7 @@ typedef struct {
} MarkupIterator; } MarkupIterator;
static int static int
MarkupIterator_init(MarkupIterator *self, PyObject *str, MarkupIterator_init(MarkupIterator *self, PyObject *str,
Py_ssize_t start, Py_ssize_t end) Py_ssize_t start, Py_ssize_t end)
{ {
SubString_init(&self->str, str, start, end); SubString_init(&self->str, str, start, end);
...@@ -713,8 +713,8 @@ MarkupIterator_next(MarkupIterator *self, SubString *literal, ...@@ -713,8 +713,8 @@ MarkupIterator_next(MarkupIterator *self, SubString *literal,
at_end = self->str.start >= self->str.end; at_end = self->str.start >= self->str.end;
len = self->str.start - start; len = self->str.start - start;
if ((c == '}') && (at_end || if ((c == '}') && (at_end ||
(c != PyUnicode_READ_CHAR(self->str.str, (c != PyUnicode_READ_CHAR(self->str.str,
self->str.start)))) { self->str.start)))) {
PyErr_SetString(PyExc_ValueError, "Single '}' encountered " PyErr_SetString(PyExc_ValueError, "Single '}' encountered "
"in format string"); "in format string");
...@@ -992,9 +992,7 @@ do_string_format_map(PyObject *self, PyObject *obj) ...@@ -992,9 +992,7 @@ do_string_format_map(PyObject *self, PyObject *obj)
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
PyObject *str;
PyUnicodeObject *str;
MarkupIterator it_markup; MarkupIterator it_markup;
} formatteriterobject; } formatteriterobject;
...@@ -1121,7 +1119,7 @@ static PyTypeObject PyFormatterIter_Type = { ...@@ -1121,7 +1119,7 @@ static PyTypeObject PyFormatterIter_Type = {
describing the parsed elements. It's a wrapper around describing the parsed elements. It's a wrapper around
stringlib/string_format.h's MarkupIterator */ stringlib/string_format.h's MarkupIterator */
static PyObject * static PyObject *
formatter_parser(PyObject *ignored, PyUnicodeObject *self) formatter_parser(PyObject *ignored, PyObject *self)
{ {
formatteriterobject *it; formatteriterobject *it;
...@@ -1158,9 +1156,7 @@ formatter_parser(PyObject *ignored, PyUnicodeObject *self) ...@@ -1158,9 +1156,7 @@ formatter_parser(PyObject *ignored, PyUnicodeObject *self)
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
PyObject *str;
PyUnicodeObject *str;
FieldNameIterator it_field; FieldNameIterator it_field;
} fieldnameiterobject; } fieldnameiterobject;
...@@ -1261,7 +1257,7 @@ static PyTypeObject PyFieldNameIter_Type = { ...@@ -1261,7 +1257,7 @@ static PyTypeObject PyFieldNameIter_Type = {
field_name_split. The iterator it returns is a field_name_split. The iterator it returns is a
FieldNameIterator */ FieldNameIterator */
static PyObject * static PyObject *
formatter_field_name_split(PyObject *ignored, PyUnicodeObject *self) formatter_field_name_split(PyObject *ignored, PyObject *self)
{ {
SubString first; SubString first;
Py_ssize_t first_idx; Py_ssize_t first_idx;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment