interrogatedb: always define PyObject_CallNoArgs as inline

This commit is contained in:
rdb 2021-12-06 22:23:44 +01:00
parent d9e335e978
commit 9dad304f85
2 changed files with 11 additions and 19 deletions

View File

@ -43,22 +43,4 @@ size_t PyLongOrInt_AsSize_t(PyObject *vv) {
}
#endif
#if PY_VERSION_HEX < 0x03090000
/**
* Most efficient way to call a function without any arguments.
*/
PyObject *PyObject_CallNoArgs(PyObject *func) {
#if PY_VERSION_HEX >= 0x03080000
return _PyObject_Vectorcall(func, nullptr, 0, nullptr);
#elif PY_VERSION_HEX >= 0x03070000
return _PyObject_FastCallDict(func, nullptr, 0, nullptr);
#elif PY_VERSION_HEX >= 0x03060000
return _PyObject_FastCall(func, nullptr, 0);
#else
static PyObject *empty_tuple = PyTuple_New(0);
return PyObject_Call(func, empty_tuple, nullptr);
#endif
}
#endif
#endif // HAVE_PYTHON

View File

@ -212,7 +212,17 @@ INLINE PyObject *_PyLong_Lshift(PyObject *a, size_t shiftby) {
/* Python 3.9 */
#if PY_VERSION_HEX < 0x03090000
EXPCL_PYPANDA PyObject *PyObject_CallNoArgs(PyObject *func);
INLINE PyObject *PyObject_CallNoArgs(PyObject *func) {
#if PY_VERSION_HEX >= 0x03080000
return _PyObject_Vectorcall(func, nullptr, 0, nullptr);
#elif PY_VERSION_HEX >= 0x03070000
return _PyObject_FastCallDict(func, nullptr, 0, nullptr);
#elif PY_VERSION_HEX >= 0x03060000
return _PyObject_FastCall(func, nullptr, 0);
#else
return PyObject_CallObject(func, nullptr);
#endif
}
INLINE PyObject *PyObject_CallOneArg(PyObject *callable, PyObject *arg) {
#if PY_VERSION_HEX >= 0x03060000