On Mon, May 16, 2022 at 12:51 PM <dw-...@d-woods.co.uk> wrote:
>
> Victor Stinner wrote:
> > On Mon, May 16, 2022 at 11:40 AM dw-...@d-woods.co.uk wrote:
> > > Cython used the private _PyUnicodeWriter API (and stopped using it on 
> > > Py3.11 when it was hidden more thoroughly)
> > > I'm not aware of any change in the the private _PyUnicodeWriter API in
> > Python 3.11.
>
> It was _PyFloat_FormatAdvancedWriter and _PyLong_FormatAdvancedWriter that 
> got moved internally to somewhere Cython couldn't easily get them I think. 
> (https://github.com/python/cpython/commit/0a883a76cda8205023c52211968bcf87bd47fd6e
>  and 
> https://github.com/python/cpython/commit/5f09bb021a2862ba89c3ecb53e7e6e95a9e07e1d).
>  Obviously it would be possible to include the internal headers and re-enable 
> it though - just turning it off was the quickest way to get it working at the 
> time though

I moved these "advanced formatter" functions to the internal C API in
batch of changes which moved most private functions to the internal C
API.

If you consider that they are useful outside Python, please open an
issue to request expose them as public functions. Right now, the
problem is that they use the _PyUnicodeWriter API which is also
private. If a public API is added to "build a string", maybe it would
make sense to add these "advanced formatter" functions to the public C
API?

My proposed API targets Python 3.12, it's too late for Python 3.11.
Maybe for Python 3.11, it's ok to add back private
_PyFloat_FormatAdvancedWriter and _PyLong_FormatAdvancedWriter
functions to the public C API to restore Cython performance.

Sadly, Cython still has to be changed at each Python release because
it still uses many private functions and private functions change
often. We have to go through this process to think about these APIs
and decide which ones should become public C functions, and which ones
are fine to be fully internal.

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/OASHJSB5HI2VN3RBCV5T3CYFTP4TZYOC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to