This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steveire
Recipients steveire
Date 2017-12-14.16:32:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1513269141.75.0.213398074469.issue32325@psf.upfronthosting.co.za>
In-reply-to
Content
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.

 https://godbolt.org/g/sswUKM

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`.
History
Date User Action Args
2017-12-14 16:32:21steveiresetrecipients: + steveire
2017-12-14 16:32:21steveiresetmessageid: <1513269141.75.0.213398074469.issue32325@psf.upfronthosting.co.za>
2017-12-14 16:32:21steveirelinkissue32325 messages
2017-12-14 16:32:21steveirecreate