[Python-Dev] Re: Expected stability of PyCode_New() and types.CodeType() signatures

2019年6月11日 15:19:24 -0700

Update.
Le ven. 31 mai 2019 à 10:49, Petr Viktorin <[email protected]> a écrit :
> PEP 570 (Positional-Only Parameters) changed the signatures of
> PyCode_New() and types.CodeType(), adding a new argument for "posargcount".
Pablo proposed a PR to revert PyCode_New() API to Python 3.7 API:
https://github.com/python/cpython/pull/13959
I dislike "PyCode_NewEx" name, it will become worse when another
parameter will be added in the future. I prefer "With" naming. I
prefer "PyCode_NewWithPosArgs()" name.
For types.CodeType constructor, well, I added CodeType.replace() to
help projects to be prepared for next CodeType constructor change :-)
But *I* am fine with breaking this constructor since very few projects
create explicitly code objects.
> Our policy for such changes seems to be fragmented tribal knowledge. I'm
> writing to check if my understanding is reasonable, so I can apply it
> and document it explicitly.
The doc has been updated:
https://bugs.python.org/issue36896
"If you instantiate any of these types, note that signatures may vary
between Python versions."
> There is a surprisingly large ecosystem of tools that create code objects.
> The expectation seems to be that these tools will need to be adapted for
> each minor version of Python.
For PyCode_New() change, it seems like (almost?) only projects using
Cython are affected, no?
To not require Cython when they are installed, many projects include C
files generated by Cython in their tarball (and other released files).
So yeah, the PyCode_New() change is very annoying in practical, since
every single project using Cython requires a new release in practice.
For this reason, I'm in favor of reverting PyCode_New() API and add a
new function with the extra positional only parameter.
> Also, the expected level of API stability should be documented in the docs.
Note: code.h header is excluded from the stable API :-) The whole file
is surrounded by "#ifndef Py_LIMITED_API".
Victor
--
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/5MKG3RWJXSM6ZEOSFUPNTPAKHQ7YRCCH/

Reply via email to