Skip to content

Commit eaafea8

Browse files
gh-102595: Document PyObject_Format c-api function (GH-102596)
(cherry picked from commit 910a64e) Co-authored-by: Nikita Sobolev <[email protected]> Def: https://github.com/python/cpython/blame/5ffdaf748d98da6065158534720f1996a45a0072/Include/abstract.hGH-L389
1 parent 21b9402 commit eaafea8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Doc/c-api/object.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ Object Protocol
161161
If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool`
162162
will always return ``1`` for :const:`Py_EQ` and ``0`` for :const:`Py_NE`.
163163
164+
.. c:function:: PyObject* PyObject_Format(PyObject *obj, PyObject *format_spec)
165+
166+
Format *obj* using *format_spec*. This is equivalent to the Python
167+
expression ``format(obj, format_spec)``.
168+
169+
*format_spec* may be ``NULL``. In this case the call is equivalent
170+
to ``format(obj)``.
171+
Returns the formatted string on success, ``NULL`` on failure.
172+
164173
.. c:function:: PyObject* PyObject_Repr(PyObject *o)
165174
166175
.. index:: builtin: repr

0 commit comments

Comments
 (0)