Skip to content

Commit 6c50a72

Browse files
miss-islingtonZeroIntensityStanFromIreland
authored
[3.14] gh-141004: Document PyErr_ProgramTextObject and PyErr_ProgramText (GH-141250) (GH-141256)
gh-141004: Document `PyErr_ProgramTextObject` and `PyErr_ProgramText` (GH-141250) (cherry picked from commit be1c72a) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
1 parent 7db06be commit 6c50a72

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Doc/c-api/exceptions.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,23 @@ For convenience, some of these functions will always return a
331331
use.
332332
333333
334+
.. c:function:: PyObject *PyErr_ProgramTextObject(PyObject *filename, int lineno)
335+
336+
Get the source line in *filename* at line *lineno*. *filename* should be a
337+
Python :class:`str` object.
338+
339+
On success, this function returns a Python string object with the found line.
340+
On failure, this function returns ``NULL`` without an exception set.
341+
342+
343+
.. c:function:: PyObject *PyErr_ProgramText(const char *filename, int lineno)
344+
345+
Similar to :c:func:`PyErr_ProgramTextObject`, but *filename* is a
346+
:c:expr:`const char *`, which is decoded with the
347+
:term:`filesystem encoding and error handler`, instead of a
348+
Python object reference.
349+
350+
334351
Issuing warnings
335352
================
336353

0 commit comments

Comments
 (0)