[Python-checkins] bpo-33738: Address review comments in GH #7477 (GH-7585)

Ned Deily webhook-mailer at python.org
Sun Jun 10 18:48:31 EDT 2018


https://github.com/python/cpython/commit/8398713cea0eb17b013f25f86bef47c7e5e63139
commit: 8398713cea0eb17b013f25f86bef47c7e5e63139
branch: master
author: Christian Tismer <tismer at stackless.com>
committer: Ned Deily <nad at python.org>
date: 2018-06-10T18:48:28-04:00
summary:

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

files:
M Include/abstract.h
M Include/pyerrors.h
M Misc/NEWS.d/next/Core and Builtins/2018-06-07-18-34-19.bpo-33738.ODZS7a.rst
M Objects/abstract.c
M Objects/exceptions.c

diff --git a/Include/abstract.h b/Include/abstract.h
index e7bc2d24bc22..c1297dbedeab 100644
--- a/Include/abstract.h
+++ b/Include/abstract.h
@@ -598,7 +598,7 @@ PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *);
     ((obj)->ob_type->tp_iternext != NULL && \
      (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented)
 #else
-PyAPI_FUNC(int) PyIter_Check(PyObject*);
+PyAPI_FUNC(int) PyIter_Check(PyObject *);
 #endif
 
 /* Takes an iterator object and calls its tp_iternext slot,
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index a9929f5f19f9..5fd981c2bae9 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -142,9 +142,9 @@ PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
 
 #ifndef Py_LIMITED_API
 #define PyExceptionClass_Name(x) \
-     ((char *)(((PyTypeObject*)(x))->tp_name))
+     ((char *)(((PyTypeObject *)(x))->tp_name))
 #else
-     PyAPI_FUNC(char *) PyExceptionClass_Name(PyObject*);
+     PyAPI_FUNC(const char *) PyExceptionClass_Name(PyObject *);
 #endif
 
 #define PyExceptionInstance_Class(x) ((PyObject*)((x)->ob_type))
diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-06-07-18-34-19.bpo-33738.ODZS7a.rst b/Misc/NEWS.d/next/Core and Builtins/2018-06-07-18-34-19.bpo-33738.ODZS7a.rst
index 0d66c4b1f191..0b7365d05a5f 100644
--- a/Misc/NEWS.d/next/Core and Builtins/2018-06-07-18-34-19.bpo-33738.ODZS7a.rst	
+++ b/Misc/NEWS.d/next/Core and Builtins/2018-06-07-18-34-19.bpo-33738.ODZS7a.rst	
@@ -1,3 +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. 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.
diff --git a/Objects/abstract.c b/Objects/abstract.c
index e2700e3f80d7..192ade115789 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1245,6 +1245,7 @@ PyNumber_Absolute(PyObject *o)
 }
 
 #undef PyIndex_Check
+
 int
 PyIndex_Check(PyObject *obj)
 {
@@ -2544,6 +2545,7 @@ PyObject_GetIter(PyObject *o)
 }
 
 #undef PyIter_Check
+
 int PyIter_Check(PyObject *obj)
 {
     return obj->ob_type->tp_iternext != NULL &&
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index bcb1fd5d07c5..7beb2a2891de 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -343,6 +343,7 @@ PyException_SetContext(PyObject *self, PyObject *context)
 }
 
 #undef PyExceptionClass_Name
+
 char *
 PyExceptionClass_Name(PyObject *ob)
 {



More information about the Python-checkins mailing list