comparison Python/exceptions.c @ 35298:b2fe5f8fcfdd legacy-trunk

PEP 342 implementation. Per Guido's comments, the generator throw() method still needs to support string exceptions, and allow None for the third argument. Documentation updates are needed, too.
author Phillip J. Eby <pje@telecommunity.com>
date Tue, 02 Aug 2005 00:46:46 +0000
parents 6641d0542592
children 7fdc639bc5b4
comparison
equal deleted inserted replaced
35297:26bf6c27e9ce 35298:b2fe5f8fcfdd
55 "\n\ 55 "\n\
56 Exception\n\ 56 Exception\n\
57 |\n\ 57 |\n\
58 +-- SystemExit\n\ 58 +-- SystemExit\n\
59 +-- StopIteration\n\ 59 +-- StopIteration\n\
60 +-- GeneratorExit\n\
60 +-- StandardError\n\ 61 +-- StandardError\n\
61 | |\n\ 62 | |\n\
62 | +-- KeyboardInterrupt\n\ 63 | +-- KeyboardInterrupt\n\
63 | +-- ImportError\n\ 64 | +-- ImportError\n\
64 | +-- EnvironmentError\n\ 65 | +-- EnvironmentError\n\
392 "Base class for all standard Python exceptions."); 393 "Base class for all standard Python exceptions.");
393 394
394 PyDoc_STRVAR(TypeError__doc__, "Inappropriate argument type."); 395 PyDoc_STRVAR(TypeError__doc__, "Inappropriate argument type.");
395 396
396 PyDoc_STRVAR(StopIteration__doc__, "Signal the end from iterator.next()."); 397 PyDoc_STRVAR(StopIteration__doc__, "Signal the end from iterator.next().");
398 PyDoc_STRVAR(GeneratorExit__doc__, "Request that a generator exit.");
397 399
398 400
399 401
400 PyDoc_STRVAR(SystemExit__doc__, "Request to exit from the interpreter."); 402 PyDoc_STRVAR(SystemExit__doc__, "Request to exit from the interpreter.");
401 403
1581 1583
1582 /* Global C API defined exceptions */ 1584 /* Global C API defined exceptions */
1583 1585
1584 PyObject *PyExc_Exception; 1586 PyObject *PyExc_Exception;
1585 PyObject *PyExc_StopIteration; 1587 PyObject *PyExc_StopIteration;
1588 PyObject *PyExc_GeneratorExit;
1586 PyObject *PyExc_StandardError; 1589 PyObject *PyExc_StandardError;
1587 PyObject *PyExc_ArithmeticError; 1590 PyObject *PyExc_ArithmeticError;
1588 PyObject *PyExc_LookupError; 1591 PyObject *PyExc_LookupError;
1589 1592
1590 PyObject *PyExc_AssertionError; 1593 PyObject *PyExc_AssertionError;
1655 * The first three classes MUST appear in exactly this order 1658 * The first three classes MUST appear in exactly this order
1656 */ 1659 */
1657 {"Exception", &PyExc_Exception}, 1660 {"Exception", &PyExc_Exception},
1658 {"StopIteration", &PyExc_StopIteration, &PyExc_Exception, 1661 {"StopIteration", &PyExc_StopIteration, &PyExc_Exception,
1659 StopIteration__doc__}, 1662 StopIteration__doc__},
1663 {"GeneratorExit", &PyExc_GeneratorExit, &PyExc_Exception,
1664 GeneratorExit__doc__},
1660 {"StandardError", &PyExc_StandardError, &PyExc_Exception, 1665 {"StandardError", &PyExc_StandardError, &PyExc_Exception,
1661 StandardError__doc__}, 1666 StandardError__doc__},
1662 {"TypeError", &PyExc_TypeError, 0, TypeError__doc__}, 1667 {"TypeError", &PyExc_TypeError, 0, TypeError__doc__},
1663 /* 1668 /*
1664 * The rest appear in depth-first order of the hierarchy 1669 * The rest appear in depth-first order of the hierarchy