Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
  • Loading branch information
2 people authored and miss-islington committed Nov 8, 2025
commit ca3bba17af5830b3a928bfd08fd4c1d2979bf146
17 changes: 17 additions & 0 deletions Doc/c-api/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,23 @@ For convenience, some of these functions will always return a
use.


.. c:function:: PyObject *PyErr_ProgramTextObject(PyObject *filename, int lineno)

Get the source line in *filename* at line *lineno*. *filename* should be a
Python :class:`str` object.

On success, this function returns a Python string object with the found line.
On failure, this function returns ``NULL`` without an exception set.


.. c:function:: PyObject *PyErr_ProgramText(const char *filename, int lineno)

Similar to :c:func:`PyErr_ProgramTextObject`, but *filename* is a
:c:expr:`const char *`, which is decoded with the
:term:`filesystem encoding and error handler`, instead of a
Python object reference.


Issuing warnings
================

Expand Down
Loading