@@ -438,7 +438,9 @@ Querying the error indicator
438
438
439
439
.. c :function :: void PyErr_Fetch (PyObject **ptype, PyObject **pvalue, PyObject **ptraceback)
440
440
441
- As of 3.12, this function is deprecated. Use :c:func: `PyErr_GetRaisedException ` instead.
441
+ .. deprecated :: 3.12
442
+
443
+ Use :c:func: `PyErr_GetRaisedException ` instead.
442
444
443
445
Retrieve the error indicator into three variables whose addresses are passed.
444
446
If the error indicator is not set, set all three variables to ``NULL ``. If it is
@@ -447,8 +449,10 @@ Querying the error indicator
447
449
448
450
.. note ::
449
451
450
- This function is normally only used by code that needs to catch exceptions or
451
- by code that needs to save and restore the error indicator temporarily, e.g.::
452
+ This function is normally only used by legacy code that needs to catch
453
+ exceptions or save and restore the error indicator temporarily.
454
+
455
+ For example::
452
456
453
457
{
454
458
PyObject *type, *value, *traceback;
@@ -459,15 +463,17 @@ Querying the error indicator
459
463
PyErr_Restore(type, value, traceback);
460
464
}
461
465
462
- .. deprecated :: 3.12
463
-
464
466
465
467
.. c :function :: void PyErr_Restore (PyObject *type, PyObject *value, PyObject *traceback)
466
468
467
- As of 3.12, this function is deprecated. Use :c:func: `PyErr_SetRaisedException ` instead.
469
+ .. deprecated :: 3.12
470
+
471
+ Use :c:func: `PyErr_SetRaisedException ` instead.
468
472
469
- Set the error indicator from the three objects. If the error indicator is
470
- already set, it is cleared first. If the objects are ``NULL ``, the error
473
+ Set the error indicator from the three objects,
474
+ *type *, *value *, and *traceback *,
475
+ clearing the existing exception if one is set.
476
+ If the objects are ``NULL ``, the error
471
477
indicator is cleared. Do not pass a ``NULL `` type and non-``NULL `` value or
472
478
traceback. The exception type should be a class. Do not pass an invalid
473
479
exception type or value. (Violating these rules will cause subtle problems
@@ -478,18 +484,17 @@ Querying the error indicator
478
484
479
485
.. note::
480
486
481
- This function is normally only used by code that needs to save and restore the
482
- error indicator temporarily. Use :c:func:`PyErr_Fetch` to save the current
483
- error indicator.
484
-
485
- .. deprecated:: 3.12
487
+ This function is normally only used by legacy code that needs to
488
+ save and restore the error indicator temporarily.
489
+ Use :c:func:`PyErr_Fetch` to save the current error indicator.
486
490
487
491
488
492
.. c:function:: void PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
489
493
490
- As of 3.12, this function is deprecated.
491
- Use :c:func: `PyErr_GetRaisedException ` instead of :c:func: `PyErr_Fetch ` to avoid
492
- any possible de-normalization.
494
+ .. deprecated :: 3.12
495
+
496
+ Use :c:func: `PyErr_GetRaisedException ` instead,
497
+ to avoid any possible de-normalization.
493
498
494
499
Under certain circumstances, the values returned by :c:func: `PyErr_Fetch ` below
495
500
can be "unnormalized", meaning that ``*exc `` is a class object but ``*val `` is
@@ -507,8 +512,6 @@ Querying the error indicator
507
512
PyException_SetTraceback(val, tb);
508
513
}
509
514
510
- .. deprecated :: 3.12
511
-
512
515
513
516
.. c :function :: PyObject* PyErr_GetHandledException (void)
514
517
@@ -756,14 +759,12 @@ Exception Objects
756
759
757
760
.. c :function :: PyObject* PyException_GetArgs (PyObject *ex)
758
761
759
- Return args of the given exception as a new reference,
760
- as accessible from Python through :attr: `args `.
762
+ Return :attr: `~BaseException.args ` of exception *ex *.
761
763
762
764
763
765
.. c :function :: void PyException_SetArgs (PyObject *ex, PyObject *args)
764
766
765
- Set the args of the given exception,
766
- as accessible from Python through :attr: `args `.
767
+ Set :attr: `~BaseException.args ` of exception *ex * to *args *.
767
768
768
769
769
770
.. _unicodeexceptions :
0 commit comments