Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2765)

Side by Side Diff: Doc/c-api/exceptions.rst

Issue 6210: Exception Chaining missing method for suppressing context
Patch Set: Created 1 year, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Doc/ACKS.txt ('k') | Doc/library/exceptions.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 .. highlightlang:: c 1 .. highlightlang:: c
2 2
3 3
4 .. _exceptionhandling: 4 .. _exceptionhandling:
5 5
6 ****************** 6 ******************
7 Exception Handling 7 Exception Handling
8 ****************** 8 ******************
9 9
10 The functions described in this chapter will let you handle and raise Python 10 The functions described in this chapter will let you handle and raise Python
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 414
415 .. c:function:: void PyException_SetContext(PyObject *ex, PyObject *ctx) 415 .. c:function:: void PyException_SetContext(PyObject *ex, PyObject *ctx)
416 416
417 Set the context associated with the exception to *ctx*. Use *NULL* to clear 417 Set the context associated with the exception to *ctx*. Use *NULL* to clear
418 it. There is no type check to make sure that *ctx* is an exception instance. 418 it. There is no type check to make sure that *ctx* is an exception instance.
419 This steals a reference to *ctx*. 419 This steals a reference to *ctx*.
420 420
421 421
422 .. c:function:: PyObject* PyException_GetCause(PyObject *ex) 422 .. c:function:: PyObject* PyException_GetCause(PyObject *ex)
423 423
424 Return the cause (another exception instance set by ``raise ... from ...``) 424 Return the cause (either an exception instance, or :keyword:`None`,
425 associated with the exception as a new reference, as accessible from Python 425 set by ``raise ... from ...``) associated with the exception as a new
426 through :attr:`__cause__`. If there is no cause associated, this returns 426 reference, as accessible from Python through :attr:`__cause__`.
427 *NULL*. 427
428 If there is no cause associated, this returns *NULL* (from Python
429 ``__cause__ is Ellipsis``). If the cause is :keyword:`None`, the default
430 exception display routines stop showing the context chain.
428 431
429 432
430 .. c:function:: void PyException_SetCause(PyObject *ex, PyObject *ctx) 433 .. c:function:: void PyException_SetCause(PyObject *ex, PyObject *ctx)
431 434
432 Set the cause associated with the exception to *ctx*. Use *NULL* to clear 435 Set the cause associated with the exception to *ctx*. Use *NULL* to clear
433 it. There is no type check to make sure that *ctx* is an exception instance. 436 it. There is no type check to make sure that *ctx* is either an exception
434 This steals a reference to *ctx*. 437 instance or :keyword:`None`. This steals a reference to *ctx*.
438
439 If the cause is set to :keyword:`None` the default exception display
440 routines will not display this exception's context, and will not follow the
441 chain any further.
435 442
436 443
437 .. _unicodeexceptions: 444 .. _unicodeexceptions:
438 445
439 Unicode Exception Objects 446 Unicode Exception Objects
440 ========================= 447 =========================
441 448
442 The following functions are used to create and modify Unicode exceptions from C. 449 The following functions are used to create and modify Unicode exceptions from C.
443 450
444 .. c:function:: PyObject* PyUnicodeDecodeError_Create(const char *encoding, cons t char *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason) 451 .. c:function:: PyObject* PyUnicodeDecodeError_Create(const char *encoding, cons t char *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason)
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 748
742 (1) 749 (1)
743 This is a base class for other standard exceptions. 750 This is a base class for other standard exceptions.
744 751
745 (2) 752 (2)
746 This is the same as :exc:`weakref.ReferenceError`. 753 This is the same as :exc:`weakref.ReferenceError`.
747 754
748 (3) 755 (3)
749 Only defined on Windows; protect code that uses this by testing that the 756 Only defined on Windows; protect code that uses this by testing that the
750 preprocessor macro ``MS_WINDOWS`` is defined. 757 preprocessor macro ``MS_WINDOWS`` is defined.
OLDNEW
« no previous file with comments | « Doc/ACKS.txt ('k') | Doc/library/exceptions.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7