OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Procedure for adding new public C API


21.05.18 16:27, Paul Moore ????:
> On 21 May 2018 at 13:41, Serhiy Storchaka <storchaka at gmail.com> wrote:
>> * Add it in PC/python3.def.
> 
> I thought python3.def should only contain symbols in the limited ABI
> (it defines the API of python3.dll, doesn't it?)

Thank you for correction. Yes, and only for Windows. New API implemented 
as macros shouldn't be included here, but if it uses some new functions, 
they should be included.

>> If you want to include it in the limited API, wrap its declaration with:
>>
>>     #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03080000
>>     #endif
>>
>> (use the correct Python version of introducing a feature in the comparison)
>>
>> If you don't want to include it in the limited API, wrap its declaration
>> with:
>>
>>     #ifndef Py_LIMITED_API
>>     #endif
> 
> Is it even acceptable to add a symbol into the limited ABI? I thought
> the idea was that if I linked with python3.dll, my code would work
> with any version of Python 3? By introducing new symbols, code linked
> with the python3.dll shipped with (say) Python 3.8 would fail to run
> if executed with the python3.dll from Python 3.5.

The limited API is versioned. If you use only Python 3.5 API (define 
Py_LIMITED_API to 0x03050000), the built code will be expected to work 
on 3.5 and later. In theory.