bpo-33738: Address review comments in GH #7477 (GH-7585)

This commit is contained in:
Christian Tismer 2018-06-11 00:48:28 +02:00 committed by Ned Deily
parent 877b23202b
commit 8398713cea
5 changed files with 8 additions and 4 deletions

View File

@ -598,7 +598,7 @@ PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *);
((obj)->ob_type->tp_iternext != NULL && \ ((obj)->ob_type->tp_iternext != NULL && \
(obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented)
#else #else
PyAPI_FUNC(int) PyIter_Check(PyObject*); PyAPI_FUNC(int) PyIter_Check(PyObject *);
#endif #endif
/* Takes an iterator object and calls its tp_iternext slot, /* Takes an iterator object and calls its tp_iternext slot,

View File

@ -142,9 +142,9 @@ PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
#ifndef Py_LIMITED_API #ifndef Py_LIMITED_API
#define PyExceptionClass_Name(x) \ #define PyExceptionClass_Name(x) \
((char *)(((PyTypeObject*)(x))->tp_name)) ((char *)(((PyTypeObject *)(x))->tp_name))
#else #else
PyAPI_FUNC(char *) PyExceptionClass_Name(PyObject*); PyAPI_FUNC(const char *) PyExceptionClass_Name(PyObject *);
#endif #endif
#define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type)) #define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type))

View File

@ -1,3 +1,4 @@
Seven macro incompatibilities with the Limited API were fixed, and the Seven macro incompatibilities with the Limited API were fixed, and the
macros PyIter_Check, PyIndex_Check and PyExceptionClass_Name were added as macros PyIter_Check, PyIndex_Check and PyExceptionClass_Name were added as
functions. A script for automatic macro checks was added. functions. The return type of PyExceptionClass_Name is "const char \*".
A script for automatic macro checks was added.

View File

@ -1245,6 +1245,7 @@ PyNumber_Absolute(PyObject *o)
} }
#undef PyIndex_Check #undef PyIndex_Check
int int
PyIndex_Check(PyObject *obj) PyIndex_Check(PyObject *obj)
{ {
@ -2544,6 +2545,7 @@ PyObject_GetIter(PyObject *o)
} }
#undef PyIter_Check #undef PyIter_Check
int PyIter_Check(PyObject *obj) int PyIter_Check(PyObject *obj)
{ {
return obj->ob_type->tp_iternext != NULL && return obj->ob_type->tp_iternext != NULL &&

View File

@ -343,6 +343,7 @@ PyException_SetContext(PyObject *self, PyObject *context)
} }
#undef PyExceptionClass_Name #undef PyExceptionClass_Name
char * char *
PyExceptionClass_Name(PyObject *ob) PyExceptionClass_Name(PyObject *ob)
{ {