bpo-40170: Always define PyExceptionClass_Name() as a function (GH-24… · python/cpython@cd80f43

3 files changed

lines changed

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.

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

{