[Python-Dev] Re: New public PyUnicodeBuilder C API

2022-05-16 Thread dw-git
Victor Stinner wrote: > 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. I think at this stage the

[Python-Dev] Re: New public PyUnicodeBuilder C API

2022-05-16 Thread Antoine Pitrou
On Mon, 16 May 2022 14:22:44 +0200 Victor Stinner wrote: > On Mon, May 16, 2022 at 2:11 PM Antoine Pitrou wrote: > > > PyUnicodeBuilder_Init(&builder); > > > > > > // Overallocation is more efficient if the final length is > > > unknown > > > PyUnicodeBuilder_EnableOvera

[Python-Dev] Re: New public PyUnicodeBuilder C API

2022-05-16 Thread Victor Stinner
On Mon, May 16, 2022 at 2:11 PM Antoine Pitrou wrote: > > PyUnicodeBuilder_Init(&builder); > > > > // Overallocation is more efficient if the final length is unknown > > PyUnicodeBuilder_EnableOverallocation(&builder); > > PyUnicodeBuilder_WriteStr(&builder, key);

[Python-Dev] Re: New public PyUnicodeBuilder C API

2022-05-16 Thread Antoine Pitrou
On Mon, 16 May 2022 11:13:56 +0200 Victor Stinner wrote: > Hi, > > I propose adding a new C API to "build an Unicode string". What do you > think? Would it be efficient with any possible Unicode string storage > and any Python implementation? > > PyPy has an UnicodeBuilder type in Python, but he

[Python-Dev] Re: New public PyUnicodeBuilder C API

2022-05-16 Thread Victor Stinner
On Mon, May 16, 2022 at 12:51 PM 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

[Python-Dev] Re: New public PyUnicodeBuilder C API

2022-05-16 Thread dw-git
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.

[Python-Dev] Re: New public PyUnicodeBuilder C API

2022-05-16 Thread Victor Stinner
On Mon, May 16, 2022 at 11:40 AM 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. Is it just that Cython no longer wants to use private A

[Python-Dev] Re: New public PyUnicodeBuilder C API

2022-05-16 Thread dw-git
Cython used the private _PyUnicodeWriter API (and stopped using it on Py3.11 when it was hidden more thoroughly) so would probably make use of a public API to do the same thing. It's an optimization rather than an essential of course ___ Python-Dev mail