gh-148250: Mention str subclasses in PyUnicodeWriter_WriteStr() doc (GH-148251)
(cherry picked from commit
8c524503cd728d609d63d9024a9e2c418ba71f40)
Co-authored-by: Victor Stinner <vstinner@python.org>
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*.