2016-12-18 9:31 GMT+01:00 Serhiy Storchaka <storch...@gmail.com>:
> 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 helps
> to found possible errors.

Since the "const" keyword does not impact the stable *ABI*, I think
that it's fine to add use it in more places.

In the worst case, if an extension chose to be compiled with -Werror
(convert warnings into errors), the maintainer will have to fix
conversion warnings in the code. But it's easy to write C code which
works with and without const (old and new Python *API*), using
explicit cast (to const char* for example).

In the common case, it will just be a warning and nobody will notice
it since more and more people use pip which compiles C extensions in
the background and doesn't show GCC output anymore.

I agree that it can help to find real bugs.

Victor
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to