[issue33829] C API: provide new object protocol helper

Serhiy Storchaka report at bugs.python.org
Mon Jun 11 06:19:00 EDT 2018


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

Is this case common enough for adding special API? The name PyObject_CallMethodArgs looks too similar to the existing name PyObject_CallMethodObjArgs, this will make confusion. If add an API that accepts the method name as C string, you need to add also an API for method name passed as Python string and a private API for method name passed as `struct _Py_Identifier *`. Adding new API has a non-zero cost. It adds maintenance burden for core developers, it increases the number of things that should be learned by users, and can leads to generating less optimal code by the compiler, because it will need to analyze more code in the same file, and it can optimize less common paths and left more common paths unoptimized.

Are you aware that you can pass the args tuple unchanged by using PyObject_CallMethod()? PyObject_CallMethod(obj, name, "O", args)

----------
nosy: +serhiy.storchaka, vstinner

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


More information about the Python-bugs-list mailing list