Skip to content

Commit 0efb799

Browse files
miss-islingtonZeroIntensityStanFromIreland
authored
[3.13] gh-141004: Document PyTraceBack* APIs (GH-141192) (GH-141211)
gh-141004: Document `PyTraceBack*` APIs (GH-141192) (cherry picked from commit d13ee0a) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
1 parent 26c2a49 commit 0efb799

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Doc/c-api/exceptions.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,3 +1225,37 @@ Warning types
12251225
12261226
.. versionadded:: 3.10
12271227
:c:data:`PyExc_EncodingWarning`.
1228+
1229+
1230+
Tracebacks
1231+
==========
1232+
1233+
.. c:var:: PyTypeObject PyTraceBack_Type
1234+
1235+
Type object for traceback objects. This is available as
1236+
:class:`types.TracebackType` in the Python layer.
1237+
1238+
1239+
.. c:function:: int PyTraceBack_Check(PyObject *op)
1240+
1241+
Return true if *op* is a traceback object, false otherwise. This function
1242+
does not account for subtypes.
1243+
1244+
1245+
.. c:function:: int PyTraceBack_Here(PyFrameObject *f)
1246+
1247+
Replace the :attr:`~BaseException.__traceback__` attribute on the current
1248+
exception with a new traceback prepending *f* to the existing chain.
1249+
1250+
Calling this function without an exception set is undefined behavior.
1251+
1252+
This function returns ``0`` on success, and returns ``-1`` with an
1253+
exception set on failure.
1254+
1255+
1256+
.. c:function:: int PyTraceBack_Print(PyObject *tb, PyObject *f)
1257+
1258+
Write the traceback *tb* into the file *f*.
1259+
1260+
This function returns ``0`` on success, and returns ``-1`` with an
1261+
exception set on failure.

0 commit comments

Comments
 (0)