Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add What's New entry
  • Loading branch information
vstinner committed Nov 1, 2023
commit 65c667132ddff29e5d253e43412d840afbdc49c3
9 changes: 8 additions & 1 deletion Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,13 @@ New Features
* Add :c:func:`PyUnicode_AsUTF8` function to the limited C API.
(Contributed by Victor Stinner in :gh:`111089`.)

* Add ``PyASCIIObject.state.embed_null`` member to Python :class:`str` objects.
It is used as a cache by :c:func:`PyUnicode_AsUTF8` to only check once if a
string contains a null character. Strings created by
:c:func:`PyUnicode_FromString` initializes *embed_null* to 0 since the string
cannot contain a null character.
(Contributed by Victor Stinner in :gh:`111089`.)


Porting to Python 3.13
----------------------
Expand Down Expand Up @@ -1192,7 +1199,7 @@ Porting to Python 3.13

* The :c:func:`PyUnicode_AsUTF8` function now raises an exception if the string
contains embedded null characters. To accept embedded null characters and
truncate on purpose at the first null byte,
truncate on purpose at the first null character,
``PyUnicode_AsUTF8AndSize(unicode, NULL)`` can be used instead.
(Contributed by Victor Stinner in :gh:`111089`.)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Add ``PyASCIIObject.state.embed_null`` member to Python str objects. It is
used as a cache by :c:func:`PyUnicode_AsUTF8` to only check once if a string
contains a null character. Strings created by :c:func:`PyUnicode_FromString`
initializes *embed_null* since the string cannot contain a null character.
initializes *embed_null* to 0 since the string cannot contain a null character.
Patch by Victor Stinner.