Răsfoiți Sursa

py_panda: backport some py_compat.h definitions

rdb 5 ani în urmă
părinte
comite
a7042091be
1 a modificat fișierele cu 22 adăugiri și 0 ștergeri
  1. 22 0
      dtool/src/interrogatedb/py_compat.h

+ 22 - 0
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.