https://github.com/python/cpython/commit/88fc1e60038378fddb4db67a7dc7427fe9982a29
commit: 88fc1e60038378fddb4db67a7dc7427fe9982a29
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: vstinner <[email protected]>
date: 2026-04-09T11:59:06Z
summary:

[3.14] gh-148250: Mention str subclasses in PyUnicodeWriter_WriteStr() doc 
(GH-148251) (#148293)

gh-148250: Mention str subclasses in PyUnicodeWriter_WriteStr() doc (GH-148251)
(cherry picked from commit 8c524503cd728d609d63d9024a9e2c418ba71f40)

Co-authored-by: Victor Stinner <[email protected]>

files:
M Doc/c-api/unicode.rst

diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index 53a13e80944c70..ab58a64647ac61 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -1868,6 +1868,10 @@ object.
    On success, return ``0``.
    On error, set an exception, leave the writer unchanged, and return ``-1``.
 
+   To write a :class:`str` subclass which overrides the :meth:`~object.__str__`
+   method, :c:func:`PyUnicode_FromObject` can be used to get the original
+   string.
+
 .. c:function:: int PyUnicodeWriter_WriteRepr(PyUnicodeWriter *writer, 
PyObject *obj)
 
    Call :c:func:`PyObject_Repr` on *obj* and write the output into *writer*.

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to