summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-03-22 09:32:08 (GMT)
committerGitHub <noreply@github.com>2023-03-22 09:32:08 (GMT)
commiteaafea86a0f49428092d359391d0a184d9ef8531 (patch)
tree8fd8e4f1572c46e20303efad97f5659df51ea7b0 /Doc
parent21b94028efc4388a43773bea877a28cf563fab70 (diff)
downloadcpython-eaafea86a0f49428092d359391d0a184d9ef8531.zip
cpython-eaafea86a0f49428092d359391d0a184d9ef8531.tar.gz
cpython-eaafea86a0f49428092d359391d0a184d9ef8531.tar.bz2
gh-102595: Document `PyObject_Format` c-api function (GH-102596)
(cherry picked from commit 910a64e3013bce821bfac75377cbe88bedf265de) Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Def: https://github.com/python/cpython/blame/5ffdaf748d98da6065158534720f1996a45a0072/Include/abstract.hGH-L389
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/object.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst
index feadf50..29920d2 100644
--- a/Doc/c-api/object.rst
+++ b/Doc/c-api/object.rst
@@ -161,6 +161,15 @@ Object Protocol
If *o1* and *o2* are the same object, :c:func:`PyObject_RichCompareBool`
will always return ``1`` for :const:`Py_EQ` and ``0`` for :const:`Py_NE`.
+.. c:function:: PyObject* PyObject_Format(PyObject *obj, PyObject *format_spec)
+
+ Format *obj* using *format_spec*. This is equivalent to the Python
+ expression ``format(obj, format_spec)``.
+
+ *format_spec* may be ``NULL``. In this case the call is equivalent
+ to ``format(obj)``.
+ Returns the formatted string on success, ``NULL`` on failure.
+
.. c:function:: PyObject* PyObject_Repr(PyObject *o)
.. index:: builtin: repr