Browse Source

bpo-40170: Always define PyExceptionClass_Name() as a function (GH-24553)

Remove macro variant of PyExceptionClass_Name().
pull/24557/head
Erlend Egeberg Aasland 5 years ago
committed by GitHub
parent
commit
cd80f430da
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      Include/cpython/pyerrors.h
  2. 3
      Misc/NEWS.d/next/C API/2021-02-16-22-29-39.bpo-40170.ahHmOo.rst
  3. 2
      Objects/exceptions.c

4
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

3
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.

2
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)
{

Loading…
Cancel
Save