From a7042091befc850566a7ca22c6e4ff3d4ed14740 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 1 Jan 2021 16:37:21 +0100 Subject: [PATCH] py_panda: backport some py_compat.h definitions --- dtool/src/interrogatedb/py_compat.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dtool/src/interrogatedb/py_compat.h b/dtool/src/interrogatedb/py_compat.h index 2152a115cc..940bf1f223 100644 --- a/dtool/src/interrogatedb/py_compat.h +++ b/dtool/src/interrogatedb/py_compat.h @@ -208,6 +208,28 @@ INLINE PyObject *_PyLong_Lshift(PyObject *a, size_t shiftby) { } #endif +#if PY_VERSION_HEX < 0x03090000 +INLINE EXPCL_PYPANDA PyObject *PyObject_CallNoArgs(PyObject *func) { + return _PyObject_CallNoArg(func); +} + +INLINE PyObject *PyObject_CallOneArg(PyObject *callable, PyObject *arg) { +#if PY_VERSION_HEX >= 0x03060000 + return _PyObject_FastCall(callable, &arg, 1); +#else + return PyObject_CallFunctionObjArgs(callable, arg, nullptr); +#endif +} + +INLINE PyObject *PyObject_CallMethodNoArgs(PyObject *obj, PyObject *name) { + return PyObject_CallMethodObjArgs(obj, name, nullptr); +} + +INLINE PyObject *PyObject_CallMethodOneArg(PyObject *obj, PyObject *name, PyObject *arg) { + return PyObject_CallMethodObjArgs(obj, name, arg, nullptr); +} +#endif + /* Other Python implementations */ // _PyErr_OCCURRED is an undocumented macro version of PyErr_Occurred.