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

3 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -78,10 +78,6 @@ PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, Py
78 78
79 79 PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
80 80
81 -/* */
82 -
83 -#define PyExceptionClass_Name(x) (((PyTypeObject*)(x))->tp_name)
84 -
85 81 /* Convenience functions */
86 82
87 83 #ifdef MS_WINDOWS
Original file line number Diff line number Diff 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 number Diff line number Diff line change
@@ -364,8 +364,6 @@ PyException_SetContext(PyObject *self, PyObject *context)
364 364 Py_XSETREF(_PyBaseExceptionObject_cast(self)->context, context);
365 365 }
366 366
367 -#undef PyExceptionClass_Name
368 -
369 367 const char *
370 368 PyExceptionClass_Name(PyObject *ob)
371 369 {