Skip to content

Commit cd80f43

Browse files
author
Erlend Egeberg Aasland
authored
bpo-40170: Always define PyExceptionClass_Name() as a function (GH-24553)
Remove macro variant of PyExceptionClass_Name().
1 parent 801bb0b commit cd80f43

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

Include/cpython/pyerrors.h

-4
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, Py
7878

7979
PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
8080

81-
/* */
82-
83-
#define PyExceptionClass_Name(x) (((PyTypeObject*)(x))->tp_name)
84-
8581
/* Convenience functions */
8682

8783
#ifdef MS_WINDOWS
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:c:func:`PyExceptionClass_Name` is now always declared as a function, in
2+
order to hide implementation details. The macro accessed
3+
:c:member:`PyTypeObject.tp_name` directly. Patch by Erlend E. Aasland.

Objects/exceptions.c

-2
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,6 @@ PyException_SetContext(PyObject *self, PyObject *context)
364364
Py_XSETREF(_PyBaseExceptionObject_cast(self)->context, context);
365365
}
366366

367-
#undef PyExceptionClass_Name
368-
369367
const char *
370368
PyExceptionClass_Name(PyObject *ob)
371369
{

0 commit comments

Comments
 (0)