summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-12-13 19:07:19 (GMT)
committerGitHub <noreply@github.com>2023-12-13 19:07:19 (GMT)
commit34714f4ac9b5cfa937ebd124c039b5dd4b796311 (patch)
tree5061fe040e99d333b852dd99794ab560b3bbe130 /Doc/c-api
parent6601962530d7d5a951aaf0d2357462e4c2e04e68 (diff)
downloadcpython-34714f4ac9b5cfa937ebd124c039b5dd4b796311.zip
cpython-34714f4ac9b5cfa937ebd124c039b5dd4b796311.tar.gz
cpython-34714f4ac9b5cfa937ebd124c039b5dd4b796311.tar.bz2
[3.12] gh-101100: Improve docs on exception attributes (GH-113057) (#113061)
gh-101100: Improve docs on exception attributes (GH-113057) (cherry picked from commit d05a180350fe20d5fde56c7e525e394a0b282703) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/exceptions.rst16
1 files changed, 10 insertions, 6 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index f27e2bb..d511978 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -528,7 +528,8 @@ Querying the error indicator
.. note::
- This function *does not* implicitly set the ``__traceback__``
+ This function *does not* implicitly set the
+ :attr:`~BaseException.__traceback__`
attribute on the exception value. If setting the traceback
appropriately is desired, the following additional snippet is needed::
@@ -740,7 +741,8 @@ Exception Objects
.. c:function:: PyObject* PyException_GetTraceback(PyObject *ex)
Return the traceback associated with the exception as a new reference, as
- accessible from Python through :attr:`__traceback__`. If there is no
+ accessible from Python through the :attr:`~BaseException.__traceback__`
+ attribute. If there is no
traceback associated, this returns ``NULL``.
@@ -754,8 +756,8 @@ Exception Objects
Return the context (another exception instance during whose handling *ex* was
raised) associated with the exception as a new reference, as accessible from
- Python through :attr:`__context__`. If there is no context associated, this
- returns ``NULL``.
+ Python through the :attr:`~BaseException.__context__` attribute.
+ If there is no context associated, this returns ``NULL``.
.. c:function:: void PyException_SetContext(PyObject *ex, PyObject *ctx)
@@ -769,7 +771,8 @@ Exception Objects
Return the cause (either an exception instance, or ``None``,
set by ``raise ... from ...``) associated with the exception as a new
- reference, as accessible from Python through :attr:`__cause__`.
+ reference, as accessible from Python through the
+ :attr:`~BaseException.__cause__` attribute.
.. c:function:: void PyException_SetCause(PyObject *ex, PyObject *cause)
@@ -778,7 +781,8 @@ Exception Objects
it. There is no type check to make sure that *cause* is either an exception
instance or ``None``. This steals a reference to *cause*.
- :attr:`__suppress_context__` is implicitly set to ``True`` by this function.
+ The :attr:`~BaseException.__suppress_context__` attribute is implicitly set
+ to ``True`` by this function.
.. c:function:: PyObject* PyException_GetArgs(PyObject *ex)