Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the public PyUnicodeWriter API #125196

Closed
vstinner opened this issue Oct 9, 2024 · 2 comments
Closed

Use the public PyUnicodeWriter API #125196

vstinner opened this issue Oct 9, 2024 · 2 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-C-API topic-unicode

Comments

vstinner added a commit to vstinner/cpython that referenced this issue Oct 9, 2024
vstinner added a commit to vstinner/cpython that referenced this issue Oct 9, 2024
vstinner added a commit to vstinner/cpython that referenced this issue Oct 9, 2024
vstinner added a commit to vstinner/cpython that referenced this issue Oct 9, 2024
vstinner added a commit to vstinner/cpython that referenced this issue Oct 9, 2024
vstinner added a commit to vstinner/cpython that referenced this issue Oct 9, 2024
@vstinner
Copy link
Member Author

vstinner commented Oct 9, 2024

I also replaced PyUnicode_New(0, 0) with Py_GetConstant(Py_CONSTANT_EMPTY_STR) in commit b9a8ca0.

vstinner added a commit to vstinner/cpython that referenced this issue Oct 9, 2024
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 9, 2024
PyUnicodeWriter_WriteStr() and PyUnicodeWriter_WriteRepr() now call
directly _PyLong_FormatWriter() if the object is an int.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 9, 2024
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.

* Avoid temporary PyUnicode_DecodeUTF8(): call
  PyUnicodeWriter_WriteUTF8() instead.
* Avoid temporary PyObject_Repr(): call PyUnicodeWriter_WriteRepr()
  instead.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 9, 2024
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.
vstinner added a commit that referenced this issue Oct 9, 2024
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.

Replace PyObject_Repr() + _PyUnicodeWriter_WriteStr()
with PyUnicodeWriter_WriteRepr().
vstinner added a commit to vstinner/cpython that referenced this issue Oct 9, 2024
vstinner added a commit that referenced this issue Oct 9, 2024
PyUnicodeWriter_WriteStr() and PyUnicodeWriter_WriteRepr() now call
directly _PyLong_FormatWriter() if the argument is an int.
vstinner added a commit that referenced this issue Oct 9, 2024
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.

* Avoid temporary PyUnicode_DecodeUTF8(): call
  PyUnicodeWriter_WriteUTF8() instead.
* Avoid temporary PyObject_Repr(): call PyUnicodeWriter_WriteRepr()
  instead.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 9, 2024
vstinner added a commit that referenced this issue Oct 9, 2024
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 10, 2024
vstinner added a commit to vstinner/cpython that referenced this issue Oct 10, 2024
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.
@encukou
Copy link
Member

encukou commented Oct 10, 2024

There's also a behaviour change: #125222 -- PyUnicodeWriter_Discard(NULL) does nothing

vstinner added a commit that referenced this issue Oct 10, 2024
Replace the private _PyUnicodeWriter with the public PyUnicodeWriter.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 10, 2024
PyCodec_ReplaceErrors() and PyCodec_BackslashReplaceErrors() now use
the public PyUnicodeWriter API.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 10, 2024
PyCodec_ReplaceErrors() and PyCodec_BackslashReplaceErrors() now use
the public PyUnicodeWriter API.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 10, 2024
vstinner added a commit to vstinner/cpython that referenced this issue Oct 10, 2024
vstinner added a commit to vstinner/cpython that referenced this issue Oct 10, 2024
Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API in _PyPegen_concatenate_strings().
@vstinner vstinner changed the title Use PyUnicodeWriter API Use the public PyUnicodeWriter API Oct 10, 2024
@JacobCoffee JacobCoffee added topic-unicode interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-C-API labels Oct 10, 2024
vstinner added a commit that referenced this issue Oct 12, 2024
Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API in _PyPegen_concatenate_strings().
vstinner added a commit to vstinner/cpython that referenced this issue Oct 14, 2024
Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API in hamt.c.

Remove _hamt_dump_format(): replace it with PyUnicodeWriter_Format().

Use PyUnicodeWriter_WriteUTF8() to write just a newline character.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 14, 2024
Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API in hamt.c.

Remove _hamt_dump_format(): replace it with PyUnicodeWriter_Format().

Use PyUnicodeWriter_WriteUTF8() to write just a newline character.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 14, 2024
Replace the private _PyUnicodeWriter API with the public
PyUnicodeWriter API in hamt.c.

Remove _hamt_dump_format(): replace it with PyUnicodeWriter_Format().

Use PyUnicodeWriter_WriteUTF8() to write constant strings.
vstinner added a commit to vstinner/cpython that referenced this issue Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) topic-C-API topic-unicode
Projects
None yet
Development

No branches or pull requests

3 participants