[issue39943] Meta: Clean up various issues in C internals

Andy Lester report at bugs.python.org
Thu Mar 26 21:41:11 EDT 2020


Andy Lester <andy at petdance.com> added the comment:

It doesn't quiet any compiler warnings given the default compiler warnings that ./configure sets.  

However, it does quiet the -Wcast-qual compiler warning that could be a helpful addition some time in the future. I think it would be great, for example, if it were made impossible to send a pointer that points at a string literal into a function that would modify its contents.

Consting pointers also helps static analyzers like splint by letting it know the intent of the API.  It makes it possible for the analyzer to detect uninitialized buffers, for example.

All of the 20 or so patches that I've submitted, like BPO 39770 that you merged, have come about from my cranking up the warning options on both GCC and clang and sifting through the warnings.  My hope is that by making more things const, we can detect existing bugs and prevent new ones.

You say "I'm not sure that it's worth it to modify exiting code."  Is your concern the amount of work it would take to find the problems?  If so, it's not that much work when you let the compiler find the problems, which I've done.  I've already spent the time digging and validating.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39943>
_______________________________________


More information about the Python-bugs-list mailing list