[Python-Dev] Re: Can we stop adding to the C API, please?

2020-06-04 Thread Barry Scott


> On 4 Jun 2020, at 16:34, Victor Stinner  wrote:
> 
> Le jeu. 4 juin 2020 à 00:14, Nathaniel Smith  a écrit :
>> On Wed, Jun 3, 2020 at 2:10 PM Victor Stinner  wrote:
>>> For the short term, my plan is to make structure opaque in the limited
>>> C API, before breaking more stuff in the public C API :-)
>> 
>> But you're also breaking the public C API:
>> https://github.com/MagicStack/immutables/issues/46
>> https://github.com/pycurl/pycurl/pull/636
>> 
>> I'm not saying you're wrong to do so, I'm just confused about whether
>> your plan is to break stuff or not and on which timescale.
> 
> Yes, my plan includes backward incompatible changes on purpose:
> https://github.com/vstinner/misc/blob/master/cpython/pep-opaque-c-api.rst#api-and-abi-incompatible-changes
> 
> The practical issue is to estimate how many C extension modules are
> broken by a specific C API change. I plan to help out to port C
> extensions to the updated C API. If the number of broken extensions is
> fine and updating them is easy/short: fine! If the number is too high,
> we have until "3.10.0 final: Monday, 2021-10-04" to revert
> incompatible changes which caused most troubles.
> 

snip

My experience with keeping PyCXX up to date with these changes is that its not 
hard
to be compatible. I support python 3.4 to 3.9 for limited and unlimited API.
(I also support python 2.7 with the same unlimited API)

Barry


> 
> Victor
> -- 
> Night gathers, and now my watch begins. It shall not end until my death.
> ___
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at 
> https://mail.python.org/archives/list/python-dev@python.org/message/23LYPNHSSIWIZKMTUYXPRHQQRH5TKPGC/
> Code of Conduct: http://python.org/psf/codeofconduct/
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/KLNOMA5UBPBGJNANA6YK7EWSI6LNAR7R/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Can we stop adding to the C API, please?

2020-06-04 Thread Victor Stinner
Le jeu. 4 juin 2020 à 00:14, Nathaniel Smith  a écrit :
> On Wed, Jun 3, 2020 at 2:10 PM Victor Stinner  wrote:
> > For the short term, my plan is to make structure opaque in the limited
> > C API, before breaking more stuff in the public C API :-)
>
> But you're also breaking the public C API:
> https://github.com/MagicStack/immutables/issues/46
> https://github.com/pycurl/pycurl/pull/636
>
> I'm not saying you're wrong to do so, I'm just confused about whether
> your plan is to break stuff or not and on which timescale.

Yes, my plan includes backward incompatible changes on purpose:
https://github.com/vstinner/misc/blob/master/cpython/pep-opaque-c-api.rst#api-and-abi-incompatible-changes

The practical issue is to estimate how many C extension modules are
broken by a specific C API change. I plan to help out to port C
extensions to the updated C API. If the number of broken extensions is
fine and updating them is easy/short: fine! If the number is too high,
we have until "3.10.0 final: Monday, 2021-10-04" to revert
incompatible changes which caused most troubles.

I adopted a similar approach for Python incompatible changes in Python
3.9 and IMO it was successful. I made most incompatible changes at the
*beginning* of the 3.9 devcycle. Then my team at Red Hat rebuilt
Fedora operating systems with Python 3.9. We got tons of package build
failures. We grouped failures and looked for the incompatible changes
causing most issues.

Then Miro and me proposed to revert a few specific changes:

* 
https://lwn.net/ml/python-dev/cabqyc3y4sbcqt5knpjgo3dvsde2nhyropyedycqg+y+0fpu...@mail.gmail.com/
* https://lwn.net/Articles/811369/

At the end, we only revert exactly two changes: (1) aliases to ABC in
the collections module and (2) the "U" mode for open(). Python 3.9
still has an impressive list of removed features (incompatible
changes!):
https://docs.python.org/dev/whatsnew/3.9.html#removed

So far, I'm aware that last changes of
https://bugs.python.org/issue39573 "[C API] Make PyObject an opaque
structure in the limited C API" broke 4 projects (cython, numpy,
immutables, pycurl). I'm surprised by the length of fixes. For the
giant numpy project, only 5 lines were modified:
https://github.com/numpy/numpy/commit/a96b18e3d4d11be31a321999cda4b795ea9eccaa

FYI I introduced Py_SET_SIZE(), Py_SET_REFCNT() and Py_SET_TYPE()
functions in 3.9 and waited until Python 3.10 to introduce
incompatible changes. So Python 3.9 is the transition version. Sadly,
I failed to find a way to emit a deprecation warning when Py_TYPE(),
Py_SIZE() or Py_REFCNT() is used as an l-value (but not emit a warning
when it's used as an r-value).

... This discussion shifted from the initial issue raised by Mark.
Please join the capi-sig mailing list to discuss incompatible changes,
I started 2 threads there last month ;-)

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/23LYPNHSSIWIZKMTUYXPRHQQRH5TKPGC/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Can we stop adding to the C API, please?

2020-06-04 Thread Chris Jerdonek
On Wed, Jun 3, 2020 at 6:09 AM Mark Shannon  wrote:

> Also, can we remove all the new API functions added in 3.9 before the
> release and it is too late?
>

I think it would be helpful to open an issue that lists the 40 new
functions, so people could more easily review them before 3.9 is released.
Only a few were discussed in this thread. Also, if the new function was
"private" ("_" prefix), is there still a concern?

--Chris
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/H2EBKRJ76WBVCWVJXIKJV3I2IN5EKAJY/
Code of Conduct: http://python.org/psf/codeofconduct/