bpo-29548: Fix some inefficient call API usage by methane · Pull Request #97 · python/cpython
if (res == NULL)
ENTER_PYTHON func = data->func; file = data->file;
arg = Py_BuildValue("(Oi)", file, (long) mask); res = PyEval_CallObject(func, arg); Py_DECREF(arg);
res = PyObject_CallFunction(func, "Oi", file, mask);
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
arg variable is no more used and can be removed, no?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I missed it.
Additionally, argument for "i" format should be int, not (long).
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additionally, argument for "i" format should be int, not (long).
Right, I spotted it as well, but then I forgot to report it, sorry :-) Hopefully you fixed it!
ENTER_PYTHON
res = PyEval_CallObject(func, NULL); res = _PyObject_CallNoArg(func); Py_DECREF(func); Py_DECREF(v); /* See Tktt_New() */