From e726c39b0a098b4e9009ca29b81288b2635d1a97 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 16 Feb 2021 22:13:54 +0100 Subject: [PATCH 1/2] bpo-40170: Remove macro variant of PyExceptionClass_Name --- Include/cpython/pyerrors.h | 4 ---- Objects/exceptions.c | 2 -- 2 files changed, 6 deletions(-) diff --git a/Include/cpython/pyerrors.h b/Include/cpython/pyerrors.h index c2500d927bf7f0..6711e8be68ffeb 100644 --- a/Include/cpython/pyerrors.h +++ b/Include/cpython/pyerrors.h @@ -78,10 +78,6 @@ PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, Py PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *); -/* */ - -#define PyExceptionClass_Name(x) (((PyTypeObject*)(x))->tp_name) - /* Convenience functions */ #ifdef MS_WINDOWS diff --git a/Objects/exceptions.c b/Objects/exceptions.c index d4824938a0f507..62cec9a90f5804 100644 --- a/Objects/exceptions.c +++ b/Objects/exceptions.c @@ -364,8 +364,6 @@ PyException_SetContext(PyObject *self, PyObject *context) Py_XSETREF(_PyBaseExceptionObject_cast(self)->context, context); } -#undef PyExceptionClass_Name - const char * PyExceptionClass_Name(PyObject *ob) { From 7e6e8d1edefd8eec89f4d3cbf1607a44d57fbfe8 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 16 Feb 2021 22:29:46 +0100 Subject: [PATCH 2/2] Add NEWS entry --- .../NEWS.d/next/C API/2021-02-16-22-29-39.bpo-40170.ahHmOo.rst | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/C API/2021-02-16-22-29-39.bpo-40170.ahHmOo.rst diff --git a/Misc/NEWS.d/next/C API/2021-02-16-22-29-39.bpo-40170.ahHmOo.rst b/Misc/NEWS.d/next/C API/2021-02-16-22-29-39.bpo-40170.ahHmOo.rst new file mode 100644 index 00000000000000..348fcce98e6310 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2021-02-16-22-29-39.bpo-40170.ahHmOo.rst @@ -0,0 +1,3 @@ +:c:func:`PyExceptionClass_Name` is now always declared as a function, in +order to hide implementation details. The macro accessed +:c:member:`PyTypeObject.tp_name` directly. Patch by Erlend E. Aasland.