06.01.20 00:20, hrfu...@gmail.com пише:
I've worked out MyCallFunction() in my actual code in the same manner described 
above, but with Py_VaBuildValue. What I did was I send all variadic arguments 
to a MyBuildValue(PyObject*, const char*, ...), the in the .c file, 
MyBuildValue will generate a va_list and pass it onto Py_VaBuildValue, then I 
force the outcome to be a tuple and pass it to PyObject_CallObject and it 
works! Nontheless, this approach seems less straightforward to having a 
PyObject_VaCallFunction, so I'm guessing it may have performance penalty.

You should not worry much about performance penalty of creating a tuple if you use format string and variable arguments, because the latter have large overhead. In common cases using Py_VaBuildValue() should be enough. In performance critical code use PyObject_CallObject() or PyObject_Call(). Or even private C API like _PyObject_FastCallDict() on your risk.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/DENARCI5XDRM26IFLJDSIO2UPMZXDYOK/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to