Requiring compilers' C11 standard mode to build CPython

IMO the Python C API should try to remain compatible with the oldest C standard in strict mode. Any new C shiny feature is causing troubles with uncommon compilers on some platforms. It can lead to compiler warnings or miscompiled code in the worst case.

There are two victims of the usage of new C shiny features in the public C API: other Python implementation fighting to be as compatible as possible with CPython (but having different memory layout, different GC)… and CPython itself! More regular simple C code ease changes of CPython in my experience.

I know that many disagree, but this issue is just another example that the C API leaks too many implementation details: structures layout and members, and inlined code. Opaque structure and opaque function calls would simply avoid these issues: it would be very basic C function declaration (C89), no fancy C feature, no compiler warning or error, no long discussion about C standard, strict C, etc.

4 Likes