[Cython] Should we start using the internal CPython APIs?

da-woods dw-git at d-woods.co.uk
Sat Nov 4 09:45:22 EDT 2023


I'm a bit late in replying to this but here are some unordered thoughts.

* I'm fairly relaxed about using `Py_BUILD_CORE` if useful - I think we 
mostly do have good fallback paths for most things so can adapt quickly 
when stuff changes.
* CYTHON_USE_CPYTHON_CORE_DETAILS sounds reasonable, but it's yet 
another variation to test.
* I wonder if fixing up the limited API implementation should be higher 
priority than creating a third level been "full" and "limited API".
* I recall we were planning to ditch c89 as a strict requirement after 
3.0? Incompatibility with C++ might be more of an issue though.
* Even so, if there's a good way of turning it off then we could say: 
"if you want strict c89 support then you can't use 
CYTHON_USE_CPYTHON_CORE_DETAILS" and people would always have options.
* Waiting and seeing may be a good option for now.

David



On 30/10/2023 20:42, Stefan Behnel wrote:
> Thank you for your comments so far.
>
> Stefan Behnel schrieb am 29.10.23 um 22:06:
>> I seriously start wondering if we shouldn't just define 
>> "Py_BUILD_CORE" (or have our own "CYTHON_USE_CPYTHON_CORE_DETAILS" 
>> macro guard that triggers its #define) and include the internal 
>> "pycore_*.h" CPython header files from here:
>>
>> https://github.com/python/cpython/tree/main/Include/internal
>
> I just remembered that there's a one major technical issue with this. 
> CPython now requires C99 for its own code base (Py3.13 actually uses 
> "-std=c11" on my side). While they care about keeping public header 
> files compatible with C89 and C++, their internal header files may not 
> always have that quality, and won't be tested for it.
>
> So, governance is one argument, but technical reasons can also make 
> this appear less appealing overall.
>
> I'll let things settle some more and see in what direction Py3.13 will 
> eventually be moving.
>
> Stefan
>
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> https://mail.python.org/mailman/listinfo/cython-devel




More information about the cython-devel mailing list