Skip to content

Commit 6bf3d70

Browse files
committed
refactor: replace PyObject_CallNoArgs(func) calls with PyObject_CallObject(func, NULL), which is available in all Python versions
1 parent 23d0576 commit 6bf3d70

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/jsTypeFactory.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,7 @@ bool callPyFunc(JSContext *cx, unsigned int argc, JS::Value *vp) {
394394

395395
// use faster calling if no arguments are needed
396396
if (((nNormalArgs + nDefaultArgs) <= 0 && !varargs)) {
397-
#if PY_VERSION_HEX >= 0x03090000
398-
pyRval = PyObject_CallNoArgs(pyFunc);
399-
#else
400-
pyRval = _PyObject_CallNoArg(pyFunc); // in Python 3.8, the API is only available under the name with a leading underscore
401-
#endif
397+
pyRval = PyObject_CallObject(pyFunc, NULL);
402398
if (PyErr_Occurred() && setPyException(cx)) { // Check if an exception has already been set in Python error stack
403399
goto failure;
404400
}

0 commit comments

Comments
 (0)