[issue1866] const arg for PyInt_FromString

Nick Coghlan report at bugs.python.org
Mon Sep 20 13:16:42 CEST 2010


Nick Coghlan <ncoghlan at gmail.com> added the comment:

I'm rejecting this due to the effect it has on the output parameters.

The patch ends up have to stick (char *) casts in several places because a pointer into the string provided via the char * input parameter is returned by each affected API to the calling function via a char **output parameter.

We can't change the signature of the output parameters since that would break existing code. That then means we also can't change the signature of the input parameters, since we can't guarantee that the recipient of the output parameter won't later use it to change things.

The calling code knows whether or not it is going to modify the pointer it receives back, and hence whether or not it is safe to cast away the const-ness of the passed in pointer.

----------
resolution:  -> rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1866>
_______________________________________


More information about the Python-bugs-list mailing list