Skip to content

Commit 8c52450

Browse files
authored
gh-148250: Mention str subclasses in PyUnicodeWriter_WriteStr() doc (#148251)
1 parent b7e1d51 commit 8c52450

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Doc/c-api/unicode.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1881,6 +1881,10 @@ object.
18811881
On success, return ``0``.
18821882
On error, set an exception, leave the writer unchanged, and return ``-1``.
18831883
1884+
To write a :class:`str` subclass which overrides the :meth:`~object.__str__`
1885+
method, :c:func:`PyUnicode_FromObject` can be used to get the original
1886+
string.
1887+
18841888
.. c:function:: int PyUnicodeWriter_WriteRepr(PyUnicodeWriter *writer, PyObject *obj)
18851889
18861890
Call :c:func:`PyObject_Repr` on *obj* and write the output into *writer*.

0 commit comments

Comments
 (0)