[Python-Dev] Let's change to C API!
Victor Stinner
vstinner at redhat.com
Tue Jul 31 06:56:04 EDT 2018
2018-07-31 9:27 GMT+02:00 Jeroen Demeyer <J.Demeyer at ugent.be>:
> On 2018-07-31 08:58, Antoine Pitrou wrote:
>>
>> I think Stefan is right that we
>> should push people towards Cython and alternatives, rather than direct
>> use of the C API (which people often fail to use correctly, in my
>> experience).
>
>
> I know this probably isn't the correct place to bring it up, but I'm sure
> that CPython itself could benefit from using Cython. For example, most of
> the C extensions in Modules/ could be written in Cython.
CPython build system has very little dependencies. We even include
vendored copies of third party libraries to make the build even
simpler:
http://pythondev.readthedocs.io/cpython.html#vendored-external-libraries
We try to make CPython build as simple as possible. I'm quite sure
that Cython rely on the stdlib. Would depending on Cython open a
chicken-and-egg issue?
I would be nice to be able to use something to "generate" C
extensions, maybe even from pure Python code. But someone has to work
on a full solution to implement that.
The statu co is that CPython uses C extensions calling directly the C API.
Some people complained that CPython doesn't use its own stable ABI for
its own stable ABI. I concur that it's an issue. Because of that,
nobody noticed that we broke the stable ABI (we did it, multiple
times...). Hum, maybe I should explain that my plan is also try to use
the "new C API" for some C extensions of the stdlib. I'm not sure if
we can do it for all C extensions, since performance matters, and
sometimes we really need to access private fields ("implementation
details").
Victor
More information about the Python-Dev
mailing list