Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up after bpo-33738. #7627

Merged
merged 1 commit into from
Jun 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Include/abstract.h
Original file line number Diff line number Diff line change
Expand Up @@ -593,12 +593,11 @@ PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *);
/* Returns 1 if the object 'obj' provides iterator protocols, and 0 otherwise.

This function always succeeds. */
PyAPI_FUNC(int) PyIter_Check(PyObject *);
#ifndef Py_LIMITED_API
#define PyIter_Check(obj) \
((obj)->ob_type->tp_iternext != NULL && \
(obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented)
#else
PyAPI_FUNC(int) PyIter_Check(PyObject *);
#endif

/* Takes an iterator object and calls its tp_iternext slot,
Expand Down Expand Up @@ -719,12 +718,11 @@ PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2);

/* Returns 1 if obj is an index integer (has the nb_index slot of the
tp_as_number structure filled in), and 0 otherwise. */
PyAPI_FUNC(int) PyIndex_Check(PyObject *);
#ifndef Py_LIMITED_API
#define PyIndex_Check(obj) \
((obj)->ob_type->tp_as_number != NULL && \
(obj)->ob_type->tp_as_number->nb_index != NULL)
#else
PyAPI_FUNC(int) PyIndex_Check(PyObject *);
#endif

/* Returns the object 'o' converted to a Python int, or NULL with an exception
Expand Down
3 changes: 1 addition & 2 deletions Include/pyerrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,10 @@ PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
#define PyExceptionInstance_Check(x) \
PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)

PyAPI_FUNC(char *) PyExceptionClass_Name(PyObject *);
#ifndef Py_LIMITED_API
#define PyExceptionClass_Name(x) \
((char *)(((PyTypeObject *)(x))->tp_name))
#else
PyAPI_FUNC(const char *) PyExceptionClass_Name(PyObject *);
#endif

#define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Seven macro incompatibilities with the Limited API were fixed, and the
macros PyIter_Check, PyIndex_Check and PyExceptionClass_Name were added as
functions. The return type of PyExceptionClass_Name is "const char \*".
macros :c:func:`PyIter_Check`, :c:func:`PyIndex_Check` and
:c:func:`PyExceptionClass_Name` were added as functions.
A script for automatic macro checks was added.
2 changes: 1 addition & 1 deletion Objects/exceptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ PyException_SetContext(PyObject *self, PyObject *context)
char *
PyExceptionClass_Name(PyObject *ob)
{
return ((PyTypeObject*)ob)->tp_name;
return (char *)((PyTypeObject*)ob)->tp_name;
}

static struct PyMemberDef BaseException_members[] = {
Expand Down