diff --git a/Include/objimpl.h b/Include/objimpl.h index 140918198dae0e..dde8df34835328 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -135,14 +135,14 @@ PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); // Alias to PyObject_New(). In Python 3.8, PyObject_NEW() called directly // PyObject_MALLOC() with _PyObject_SIZE(). -#define PyObject_NEW(type, typeobj) PyObject_New((type), (typeobj)) +#define PyObject_NEW(type, typeobj) PyObject_New(type, (typeobj)) #define PyObject_NewVar(type, typeobj, n) \ ( (type *) _PyObject_NewVar((typeobj), (n)) ) // Alias to PyObject_NewVar(). In Python 3.8, PyObject_NEW_VAR() called // directly PyObject_MALLOC() with _PyObject_VAR_SIZE(). -#define PyObject_NEW_VAR(type, typeobj, n) PyObject_NewVar((type), (typeobj), (n)) +#define PyObject_NEW_VAR(type, typeobj, n) PyObject_NewVar(type, (typeobj), (n)) /* diff --git a/Misc/NEWS.d/next/C API/2022-06-23-15-00-49.gh-issue-94185.dQkHfg.rst b/Misc/NEWS.d/next/C API/2022-06-23-15-00-49.gh-issue-94185.dQkHfg.rst new file mode 100644 index 00000000000000..5a7b0fafb1bd5a --- /dev/null +++ b/Misc/NEWS.d/next/C API/2022-06-23-15-00-49.gh-issue-94185.dQkHfg.rst @@ -0,0 +1,7 @@ +Fix PyObject_NEW and PyObject_NEW_VAR + +The commit 7ad6f74 tried to add brackets to tons of macros, but they break +PyObject_New and PyObject_MEW_VAR since the macro would expand to ((Type)*) +which breaks compilation for those CPython headers. + +Fix the issue 94185.