https://github.com/python/cpython/commit/e46b808978c9dac0fedfe6b612331af390f8c8ff
commit: e46b808978c9dac0fedfe6b612331af390f8c8ff
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: ZeroIntensity <[email protected]>
date: 2025-11-08T15:53:28Z
summary:

[3.13] gh-141004: Document `PyErr_ProgramTextObject` and `PyErr_ProgramText` 
(GH-141250) (GH-141257)

gh-141004: Document `PyErr_ProgramTextObject` and `PyErr_ProgramText` 
(GH-141250)
(cherry picked from commit be1c72a45d54cdd35e0a830e18224c4c74be808c)

Co-authored-by: Peter Bierma <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>

files:
M Doc/c-api/exceptions.rst

diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index bc25dd439ab2ed..c889d812a97b8c 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -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
 ================
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to