https://github.com/python/cpython/commit/8c524503cd728d609d63d9024a9e2c418ba71f40
commit: 8c524503cd728d609d63d9024a9e2c418ba71f40
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-04-09T13:53:10+02:00
summary:
gh-148250: Mention str subclasses in PyUnicodeWriter_WriteStr() doc (#148251)
files:
M Doc/c-api/unicode.rst
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index 679823948e73b5..059a7ef399ae0f 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -1881,6 +1881,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]