Issue 32325: C API should use 'const char *' instead of 'char *' (original) (raw)
When using C++ to extend python, one may use PyGetSetDef for example:
static PyGetSetDef Noddy_getseters[] = { {"first", (getter)Noddy_getfirst, (setter)Noddy_setfirst, "first name", NULL}, {"last", (getter)Noddy_getlast, (setter)Noddy_setlast, "last name", NULL}, {NULL} /* Sentinel */ };
However, in C++ implicit conversion from const char* to char* is deprecated since C++98, and is a removed conversion in C++11.
GCC/Clang warn about this, and MSVC in conformance mode (/permissive-) errors on it.
PyGetSetDef and similar APIs should use const char* instead of char* for members such as name
.