[issue29548] deprecate PyEval_Call*() functions.

STINNER Victor report at bugs.python.org
Tue Feb 14 05:13:06 EST 2017


STINNER Victor added the comment:

"you now add the extra support for args being NULL to PyObject_Call()"

I dislike this idea. I don't want to change the API of this function.

If it is likely that NULL is the result of a previous error:

args = Py_BuildValue(...);
res = PyObject_Call(func, args, NULL);

There are already enough ways to call a function with no argument:

res = PyObject_CallFunction(func, NULL);
res = PyObject_CallFunctionObjArgs(func, NULL);
res = _PyObject_CallNoArg(func)   # private

If you want to call a function only with keyword arguments, well, create an empty tuple ... which is a singleton in CPython, no risk of memory allocation failure ... and use PyObject_Call(), no?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29548>
_______________________________________


More information about the Python-bugs-list mailing list