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

2018-05-22 Thread Paul Moore
On 22 May 2018 at 18:00, Steve Dower  wrote:
> On 21May2018 0708, Paul Moore wrote:
>>
>> On 21 May 2018 at 14:42, Serhiy Storchaka  wrote:

 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 0x0305), the built code will be expected to work on
>>> 3.5 and later. In theory.
>>
>>
>> Thanks, I'd missed that point (I need to go and check my build
>> process, in that case :-)).
>
>
> The fact that the headers and python3.def claim different functions are in
> the limited API basically breaks any ability to use this. You really do need
> to build with the oldest possible version.
>
> Alternatively, we can try again to get everyone to agree that since their
> APIs shipped as stable in earlier versions that we need to actually make
> them stable (or take a breaking backwards incompatible change to make them
> non-stable). Last time Zach and I attempted this we got nowhere. (There's a
> bug on bpo somewhere with details and helper scripts, as well as unrecorded
> discussions from the sprints a couple years ago.)
>
> Sorry to be the bearer of bad news.

I think I recall the earlier discussion.

I agree that the current situation makes the stable ABI less useful
than it would otherwise have been. But being able to build an
embedding application or extension, and say "this will work with any
version of Python newer than the version I built it with" is still
very useful.

Paul
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2018-05-22 Thread Steve Dower

On 21May2018 0708, Paul Moore wrote:

On 21 May 2018 at 14:42, Serhiy Storchaka  wrote:

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 0x0305), the built code will be expected to work on
3.5 and later. In theory.


Thanks, I'd missed that point (I need to go and check my build
process, in that case :-)).


The fact that the headers and python3.def claim different functions are 
in the limited API basically breaks any ability to use this. You really 
do need to build with the oldest possible version.


Alternatively, we can try again to get everyone to agree that since 
their APIs shipped as stable in earlier versions that we need to 
actually make them stable (or take a breaking backwards incompatible 
change to make them non-stable). Last time Zach and I attempted this we 
got nowhere. (There's a bug on bpo somewhere with details and helper 
scripts, as well as unrecorded discussions from the sprints a couple 
years ago.)


Sorry to be the bearer of bad news.

Cheers,
Steve
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2018-05-21 Thread Masayuki YAMAMOTO
Thanks Serhiy, I missed adding PyThread_tss_* to Doc/data/refcounts.dat. I
opened a PR to fix it.
https://github.com/python/cpython/pull/7038

Regards,
Masayuki

2018-05-21 21:41 GMT+09:00 Serhiy Storchaka :

> Please don't forgot to perform the following steps when add a  new public
> C API:
>
> * Document it in Doc/c-api/.
>
> * Add an entry in the What's New document.
>
> * Add it in Doc/data/refcounts.dat.
>
> * Add it in PC/python3.def.
>
> If you want to include it in the limited API, wrap its declaration with:
>
>#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x0308
>#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
>
> You are free of adding private C API, but its name should start with _Py
> or _PY and its declaration should be wrapped with:
>
>#ifndef Py_LIMITED_API
>#endif
>
> ___
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/ma3yuki.
> 8mamo10%40gmail.com
>
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2018-05-21 Thread Paul Moore
On 21 May 2018 at 14:42, Serhiy Storchaka  wrote:
>> 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 0x0305), the built code will be expected to work on
> 3.5 and later. In theory.

Thanks, I'd missed that point (I need to go and check my build
process, in that case :-)).

Paul
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2018-05-21 Thread Serhiy Storchaka

21.05.18 16:27, Paul Moore пише:

On 21 May 2018 at 13:41, Serhiy Storchaka  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 >= 0x0308
#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 0x0305), the built code will be expected to work 
on 3.5 and later. In theory.


___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2018-05-21 Thread Paul Moore
On 21 May 2018 at 13:41, Serhiy Storchaka  wrote:
> Please don't forgot to perform the following steps when add a  new public C
> API:
>
> * Document it in Doc/c-api/.
>
> * Add an entry in the What's New document.
>
> * Add it in Doc/data/refcounts.dat.
>
> * 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?)

> If you want to include it in the limited API, wrap its declaration with:
>
>#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x0308
>#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.

I have code that links with python3.dll, which is expected to run with
any version of Python 3, so this isn't theoretical. (I'm not 100% sure
whether, if I build with a Python 3.5 version of the headers, my code
will link with a python3.dll with extra symbols - but even if that's
the case, requiring cross-version binaries to be built with the oldest
version of Python that they support seems restrictive at best.

> You are free of adding private C API, but its name should start with _Py or
> _PY and its declaration should be wrapped with:
>
>#ifndef Py_LIMITED_API
>#endif

Paul
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2018-05-21 Thread Ned Deily
On May 21, 2018, at 08:41, Serhiy Storchaka  wrote:
> Please don't forgot to perform the following steps when add a  new public C 
> API:
> [...]

Perhaps this should be added to the Python Developer's Guide?

--
  Ned Deily
  n...@python.org -- []

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


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

2018-05-21 Thread Serhiy Storchaka
Please don't forgot to perform the following steps when add a  new 
public C API:


* Document it in Doc/c-api/.

* Add an entry in the What's New document.

* Add it in Doc/data/refcounts.dat.

* Add it in PC/python3.def.

If you want to include it in the limited API, wrap its declaration with:

   #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x0308
   #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

You are free of adding private C API, but its name should start with _Py 
or _PY and its declaration should be wrapped with:


   #ifndef Py_LIMITED_API
   #endif

___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com