[Python-Dev] Can we use "designated initializer" widely in coremodules?

Nathaniel Smith njs at pobox.com
Tue Jan 17 21:35:27 EST 2017


On Tue, Jan 17, 2017 at 4:48 PM, INADA Naoki <songofacandy at gmail.com> wrote:
> On Wed, Jan 18, 2017 at 8:48 AM, Larry Hastings <larry at hastings.org> wrote:
>>
>> On 01/17/2017 12:02 PM, Steve Dower wrote:
>>
>> Avoiding header files would be my only request. As Brett says, the C99
>> requirement should not be enforced on all embedders or extenders, so we
>> should try and keep the headers they'll use as compatible as possible.
>>
>>
>
> C99 style comment is used in header file already.
> see http://bugs.python.org/issue29215
>
>>
>> While that's a reasonable policy, unless we have a way to automatically
>> detect that I suspect C99 stuff will creep into the header files and break
>> the non-C99 customers.  Maybe we could get some sort of buildbot that
>> exercises this scenario?
>>
>
> How about `gcc -ansi` ?

I think the main concern isn't C90 compatibility, but C++
compatibility, right? The reason CPython is switching to allowing
(most of) C99 internally is that it seems like that it's now supported
as a matter of course on all the platforms we care about, so while
it's theoretically possible that someone uses C99 compiler to build
Python but then switches to a C90 compiler to build extensions, it
seems pretty unlikely. (Especially since the last hold-out on C99
support was MSVC, and on Windows we already force people to build
extensions using the same version of MSVC as was used to build
CPython.)

OTOH it is definitely important that the Python header files remain
polyglot C99-and-C++ compatible.

Even a simple check like:

echo '#include <Python.h>' > test.cc && g++ -c test.cc -o /dev/null

would probably catch most issues here.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Python-Dev mailing list