[issue37483] Add PyObject_CallOneArg()

STINNER Victor report at bugs.python.org
Wed Jul 3 05:29:42 EDT 2019


STINNER Victor <vstinner at redhat.com> added the comment:

> Variadic macros are not part of C89, so that would require changing PEP 7.

PEP 7 uses C99 since Python 3.6:
https://www.python.org/dev/peps/pep-0007/#c-dialect

> What do you think about macro like this?

Macros cannot be used in all C extensions. For the PEP 587, I was asked to replace macros with functions.

I would prefer a PyObject_CallOneArg() function than yet another ugly and dangerous macro. Sometimes, a regular function is better for stack consumption: it doesn't increase the stack consumption in the call site, stack memory is "released" once PyObject_CallOneArg() exit. In the past, I had to disable inlining in some functions to reduce the stack consumption. (I'm not sure if this optimization is still around.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37483>
_______________________________________


More information about the Python-bugs-list mailing list