[issue32240] Add the const qualifier for PyObject* array arguments

Serhiy Storchaka report at bugs.python.org
Thu Dec 7 07:17:15 EST 2017


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

I don't like "PyConstObjectArray" or any other name. I will just obfuscate the C code. "PyObject * const *args" should be clear for every C programmer, but if I see "PyConstObjectArray" I need to search the definition of it in the header files. And it is easy to make a mistake by using "PyConstObjectArray *" instead of "PyConstObjectArray" since complex types usually are passed by pointer in C.

If you prefer, "PyObject * const *args" can be written as "PyObject * const args[]". This is an identical syntax, but the latter form is used more rarely.

----------

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


More information about the Python-bugs-list mailing list