[Python-Dev] Const-correctness in C-API Object Protocol

Antoine Pitrou solipsis at pitrou.net
Tue Feb 22 21:55:46 CET 2011


On Tue, 22 Feb 2011 21:48:51 +0100
Stefan Behnel <stefan_ml at behnel.de> wrote:
> Reid Kleckner, 22.02.2011 21:21:
> > On Tue, Feb 22, 2011 at 2:09 PM, Eric Smith wrote:
> >> Also changing it now would be a giant hassle, leading to so-called "const
> >> poisoning" where many, many APIs need to be changed before everything would
> >> again work.
> >
> > The poisoning will not break any users of the API, though, since they
> > can pass const and non-const pointers.  Internally Python would have
> > to go through and add const keywords as appropriate when passing
> > strings around.  IMO it's worth it to not cause this warning for
> > users.
> 
> The problem is that Python's C-API functions are used both internally and 
> externally, so changes like this can easily impact other public API 
> functions because the function being changed uses them.

How so?





More information about the Python-Dev mailing list