STINNER Victor added the comment:

Hum, I would like to discuss this topic on python-dev.

Changing PyUnicode_AsUTF8() alone is fine, but the issue with changing return 
type is that the const has to be propagated to callers, and then to callers of 
callers, etc. For example, if your patch, you cast (const char*) to (char*) to 
call tp_getattr.

The question is why tp_getattr doesn't use (const char*)?

I would prefer to take an overall decision for the C API, to decide if it's ok 
to "propagate" const changes in various places of the C API.

About the stable API: in fact, it's more a stable *ABI*: PEP 384, "Defining a 
Stable ABI". At the ABI level, there is no more "const". So it's perfectly fine 
to add or remove const, we already did that in the past.

Obviously, such change should only be done in Python 3.7.

For me, the main issue is for Python modules compiled with -Werror: if they 
upgrade to Python 3.7, the compilation will fail because they cast (const 
char*) to (char*) implicitly, which is a warning when using -Wall -Wextra, 
warning converted to a compilation error.

That's why I suggest to have an overall discussion on const on python-dev ;-)

----------
nosy: +haypo

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28769>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to