File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,15 @@ will be added. The effect of this specifier with an expression ``value`` will b
108108:py:func: `python:pprint.pformat `, passing ``value `` as the only argument. In this initial specification, it
109109will be an error to provide any format specifier if ``!p `` is used.
110110
111+ Additions to the C-API
112+ ----------------------
113+
114+ To support ``!p ``, a new function, ``PyObject_Pretty() `` is added to the
115+ `Limited C API <https://docs.python.org/3/c-api/stable.html#limited-c-api >`_.
116+ This function takes a single ``PyObject * ``, the object to pretty print. This
117+ function imports the ``pprint `` module and calls :func: `pprint.pformat ` with
118+ this object as its argument, returning the results.
119+
111120.. _examples :
112121
113122Examples
@@ -305,6 +314,7 @@ Change History
305314 * Specify that the ``!p `` conversion in f-strings and ``str.format() `` implicitly perform an
306315 import of the ``pprint `` module.
307316 * Clarify the language around the new optional keyword-only argument ``pretty `` to ``print() ``.
317+ * Describe the new Limited C API function ``PyObject_Pretty() ``.
308318
309319
310320Copyright
You can’t perform that action at this time.
0 commit comments