Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 1 | #ifndef Py_ERRORS_H |
| 2 | #define Py_ERRORS_H |
| 3 | #ifdef __cplusplus |
| 4 | extern "C" { |
| 5 | #endif |
| 6 | |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 7 | /*********************************************************** |
Guido van Rossum | 5799b52 | 1995-01-04 19:06:22 +0000 | [diff] [blame] | 8 | Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
| 9 | The Netherlands. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 10 | |
| 11 | All Rights Reserved |
| 12 | |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame] | 13 | Permission to use, copy, modify, and distribute this software and its |
| 14 | documentation for any purpose and without fee is hereby granted, |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 15 | provided that the above copyright notice appear in all copies and that |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame] | 16 | both that copyright notice and this permission notice appear in |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 17 | supporting documentation, and that the names of Stichting Mathematisch |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame] | 18 | Centrum or CWI or Corporation for National Research Initiatives or |
| 19 | CNRI not be used in advertising or publicity pertaining to |
| 20 | distribution of the software without specific, written prior |
| 21 | permission. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 22 | |
Guido van Rossum | d266eb4 | 1996-10-25 14:44:06 +0000 | [diff] [blame] | 23 | While CWI is the initial source for this software, a modified version |
| 24 | is made available by the Corporation for National Research Initiatives |
| 25 | (CNRI) at the Internet address ftp://ftp.python.org. |
| 26 | |
| 27 | STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH |
| 28 | REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF |
| 29 | MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH |
| 30 | CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL |
| 31 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 32 | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 33 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 34 | PERFORMANCE OF THIS SOFTWARE. |
Guido van Rossum | f70e43a | 1991-02-19 12:39:46 +0000 | [diff] [blame] | 35 | |
| 36 | ******************************************************************/ |
| 37 | |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 38 | /* Error handling definitions */ |
| 39 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 40 | void PyErr_SetNone Py_PROTO((PyObject *)); |
| 41 | void PyErr_SetObject Py_PROTO((PyObject *, PyObject *)); |
Guido van Rossum | 067998f | 1996-12-10 15:33:34 +0000 | [diff] [blame] | 42 | void PyErr_SetString Py_PROTO((PyObject *, const char *)); |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 43 | PyObject *PyErr_Occurred Py_PROTO((void)); |
| 44 | void PyErr_Clear Py_PROTO((void)); |
| 45 | void PyErr_Fetch Py_PROTO((PyObject **, PyObject **, PyObject **)); |
| 46 | void PyErr_Restore Py_PROTO((PyObject *, PyObject *, PyObject *)); |
Guido van Rossum | 85a5fbb | 1990-10-14 12:07:46 +0000 | [diff] [blame] | 47 | |
Barry Warsaw | c0dc92a | 1997-08-22 21:22:58 +0000 | [diff] [blame] | 48 | /* Error testing and normalization */ |
| 49 | int PyErr_GivenExceptionMatches Py_PROTO((PyObject *, PyObject *)); |
| 50 | int PyErr_ExceptionMatches Py_PROTO((PyObject *)); |
| 51 | void PyErr_NormalizeException Py_PROTO((PyObject**, PyObject**, PyObject**)); |
| 52 | |
| 53 | |
Guido van Rossum | 3f5da24 | 1990-12-20 15:06:42 +0000 | [diff] [blame] | 54 | /* Predefined exceptions */ |
Guido van Rossum | 5c600e1 | 1990-10-14 20:00:25 +0000 | [diff] [blame] | 55 | |
Guido van Rossum | 0474832 | 1997-09-16 18:43:15 +0000 | [diff] [blame] | 56 | extern DL_IMPORT(PyObject *) PyExc_Exception; |
Barry Warsaw | 392d827 | 1997-08-29 21:56:07 +0000 | [diff] [blame] | 57 | extern DL_IMPORT(PyObject *) PyExc_StandardError; |
Barry Warsaw | 65349a3 | 1997-09-16 21:50:36 +0000 | [diff] [blame] | 58 | extern DL_IMPORT(PyObject *) PyExc_ArithmeticError; |
Barry Warsaw | 392d827 | 1997-08-29 21:56:07 +0000 | [diff] [blame] | 59 | extern DL_IMPORT(PyObject *) PyExc_LookupError; |
| 60 | |
Guido van Rossum | 6fa4466 | 1997-04-02 05:22:53 +0000 | [diff] [blame] | 61 | extern DL_IMPORT(PyObject *) PyExc_AssertionError; |
Guido van Rossum | 051ab12 | 1995-02-27 10:17:52 +0000 | [diff] [blame] | 62 | extern DL_IMPORT(PyObject *) PyExc_AttributeError; |
Guido van Rossum | 051ab12 | 1995-02-27 10:17:52 +0000 | [diff] [blame] | 63 | extern DL_IMPORT(PyObject *) PyExc_EOFError; |
Guido van Rossum | 7d4266e | 1997-02-14 22:53:12 +0000 | [diff] [blame] | 64 | extern DL_IMPORT(PyObject *) PyExc_FloatingPointError; |
Guido van Rossum | 051ab12 | 1995-02-27 10:17:52 +0000 | [diff] [blame] | 65 | extern DL_IMPORT(PyObject *) PyExc_IOError; |
| 66 | extern DL_IMPORT(PyObject *) PyExc_ImportError; |
| 67 | extern DL_IMPORT(PyObject *) PyExc_IndexError; |
| 68 | extern DL_IMPORT(PyObject *) PyExc_KeyError; |
| 69 | extern DL_IMPORT(PyObject *) PyExc_KeyboardInterrupt; |
| 70 | extern DL_IMPORT(PyObject *) PyExc_MemoryError; |
| 71 | extern DL_IMPORT(PyObject *) PyExc_NameError; |
| 72 | extern DL_IMPORT(PyObject *) PyExc_OverflowError; |
| 73 | extern DL_IMPORT(PyObject *) PyExc_RuntimeError; |
| 74 | extern DL_IMPORT(PyObject *) PyExc_SyntaxError; |
| 75 | extern DL_IMPORT(PyObject *) PyExc_SystemError; |
| 76 | extern DL_IMPORT(PyObject *) PyExc_SystemExit; |
| 77 | extern DL_IMPORT(PyObject *) PyExc_TypeError; |
| 78 | extern DL_IMPORT(PyObject *) PyExc_ValueError; |
| 79 | extern DL_IMPORT(PyObject *) PyExc_ZeroDivisionError; |
Guido van Rossum | 3e55cb6 | 1990-10-21 22:09:30 +0000 | [diff] [blame] | 80 | |
Barry Warsaw | 392d827 | 1997-08-29 21:56:07 +0000 | [diff] [blame] | 81 | extern DL_IMPORT(PyObject *) PyExc_MemoryErrorInst; |
| 82 | |
| 83 | |
Guido van Rossum | 5c600e1 | 1990-10-14 20:00:25 +0000 | [diff] [blame] | 84 | /* Convenience functions */ |
| 85 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 86 | extern int PyErr_BadArgument Py_PROTO((void)); |
| 87 | extern PyObject *PyErr_NoMemory Py_PROTO((void)); |
| 88 | extern PyObject *PyErr_SetFromErrno Py_PROTO((PyObject *)); |
Guido van Rossum | c4193f1 | 1997-02-14 17:10:25 +0000 | [diff] [blame] | 89 | extern PyObject *PyErr_Format Py_PROTO((PyObject *, const char *, ...)); |
Guido van Rossum | 3e55cb6 | 1990-10-21 22:09:30 +0000 | [diff] [blame] | 90 | |
Guido van Rossum | caa6380 | 1995-01-12 11:45:45 +0000 | [diff] [blame] | 91 | extern void PyErr_BadInternalCall Py_PROTO((void)); |
Guido van Rossum | 2583165 | 1993-05-19 14:50:45 +0000 | [diff] [blame] | 92 | |
Guido van Rossum | 2d2c344 | 1997-09-16 21:50:37 +0000 | [diff] [blame] | 93 | /* Function to create a new exception */ |
| 94 | PyObject *PyErr_NewException Py_PROTO((char *name, PyObject *base, |
| 95 | PyObject *dict)); |
| 96 | |
Barry Warsaw | f3f41a9 | 1997-01-03 00:15:03 +0000 | [diff] [blame] | 97 | /* In sigcheck.c or signalmodule.c */ |
| 98 | extern int PyErr_CheckSignals Py_PROTO((void)); |
| 99 | extern void PyErr_SetInterrupt Py_PROTO((void)); |
| 100 | |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 101 | |
Guido van Rossum | a330996 | 1993-07-28 09:05:47 +0000 | [diff] [blame] | 102 | #ifdef __cplusplus |
| 103 | } |
| 104 | #endif |
| 105 | #endif /* !Py_ERRORS_H */ |