Re: [Python-Dev] Constifying C API

2016-12-19 Thread Victor Stinner
2016-12-18 9:31 GMT+01:00 Serhiy Storchaka : > Originally C API didn't use the const qualifier. Over few last years the > const qualifier was added to C API if that preserved backward compatibility. > For example input "char *" parameters were changed to "const char *". This > makes C API compatibl

Re: [Python-Dev] Constifying C API

2016-12-18 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/18/2016 07:54 PM, Nick Coghlan wrote: > On 18 December 2016 at 18:31, Serhiy Storchaka > wrote: > >> Later I'm planning following changes: >> >> * Add the const qualifier to the result of functions that return >> references to internal repres

Re: [Python-Dev] Constifying C API

2016-12-18 Thread Nick Coghlan
On 18 December 2016 at 18:31, Serhiy Storchaka wrote: > Later I'm planning following changes: > > * Add the const qualifier to the result of functions that return > references to internal representation of immutable objects, like > PyBytes_AS_STRING() or PyUnicode_DATA(). While CPython internally

[Python-Dev] Constifying C API

2016-12-18 Thread Serhiy Storchaka
Originally C API didn't use the const qualifier. Over few last years the const qualifier was added to C API if that preserved backward compatibility. For example input "char *" parameters were changed to "const char *". This makes C API compatible with C++, eliminates C compiler warnings, and h