blob: e77f7def01026f48296f825d69e71d7d5e04b7b0 [file] [log] [blame]
Guido van Rossuma3309961993-07-28 09:05:47 +00001#ifndef Py_ERRORS_H
2#define Py_ERRORS_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
Guido van Rossumf70e43a1991-02-19 12:39:46 +00007/***********************************************************
Guido van Rossum5799b521995-01-04 19:06:22 +00008Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
9The Netherlands.
Guido van Rossumf70e43a1991-02-19 12:39:46 +000010
11 All Rights Reserved
12
Guido van Rossumd266eb41996-10-25 14:44:06 +000013Permission to use, copy, modify, and distribute this software and its
14documentation for any purpose and without fee is hereby granted,
Guido van Rossumf70e43a1991-02-19 12:39:46 +000015provided that the above copyright notice appear in all copies and that
Guido van Rossumd266eb41996-10-25 14:44:06 +000016both that copyright notice and this permission notice appear in
Guido van Rossumf70e43a1991-02-19 12:39:46 +000017supporting documentation, and that the names of Stichting Mathematisch
Guido van Rossumd266eb41996-10-25 14:44:06 +000018Centrum or CWI or Corporation for National Research Initiatives or
19CNRI not be used in advertising or publicity pertaining to
20distribution of the software without specific, written prior
21permission.
Guido van Rossumf70e43a1991-02-19 12:39:46 +000022
Guido van Rossumd266eb41996-10-25 14:44:06 +000023While CWI is the initial source for this software, a modified version
24is made available by the Corporation for National Research Initiatives
25(CNRI) at the Internet address ftp://ftp.python.org.
26
27STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
28REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
29MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
30CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
31DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
32PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
33TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
34PERFORMANCE OF THIS SOFTWARE.
Guido van Rossumf70e43a1991-02-19 12:39:46 +000035
36******************************************************************/
37
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000038/* Error handling definitions */
39
Guido van Rossum43466ec1998-12-04 18:48:25 +000040DL_IMPORT(void) PyErr_SetNone Py_PROTO((PyObject *));
41DL_IMPORT(void) PyErr_SetObject Py_PROTO((PyObject *, PyObject *));
42DL_IMPORT(void) PyErr_SetString Py_PROTO((PyObject *, const char *));
43DL_IMPORT(PyObject *) PyErr_Occurred Py_PROTO((void));
44DL_IMPORT(void) PyErr_Clear Py_PROTO((void));
45DL_IMPORT(void) PyErr_Fetch Py_PROTO((PyObject **, PyObject **, PyObject **));
46DL_IMPORT(void) PyErr_Restore Py_PROTO((PyObject *, PyObject *, PyObject *));
Guido van Rossum85a5fbb1990-10-14 12:07:46 +000047
Barry Warsawc0dc92a1997-08-22 21:22:58 +000048/* Error testing and normalization */
Guido van Rossum43466ec1998-12-04 18:48:25 +000049DL_IMPORT(int) PyErr_GivenExceptionMatches Py_PROTO((PyObject *, PyObject *));
50DL_IMPORT(int) PyErr_ExceptionMatches Py_PROTO((PyObject *));
51DL_IMPORT(void) PyErr_NormalizeException Py_PROTO((PyObject**, PyObject**, PyObject**));
Barry Warsawc0dc92a1997-08-22 21:22:58 +000052
53
Guido van Rossum3f5da241990-12-20 15:06:42 +000054/* Predefined exceptions */
Guido van Rossum5c600e11990-10-14 20:00:25 +000055
Guido van Rossum04748321997-09-16 18:43:15 +000056extern DL_IMPORT(PyObject *) PyExc_Exception;
Barry Warsaw392d8271997-08-29 21:56:07 +000057extern DL_IMPORT(PyObject *) PyExc_StandardError;
Barry Warsaw65349a31997-09-16 21:50:36 +000058extern DL_IMPORT(PyObject *) PyExc_ArithmeticError;
Barry Warsaw392d8271997-08-29 21:56:07 +000059extern DL_IMPORT(PyObject *) PyExc_LookupError;
60
Guido van Rossum6fa44661997-04-02 05:22:53 +000061extern DL_IMPORT(PyObject *) PyExc_AssertionError;
Guido van Rossum051ab121995-02-27 10:17:52 +000062extern DL_IMPORT(PyObject *) PyExc_AttributeError;
Guido van Rossum051ab121995-02-27 10:17:52 +000063extern DL_IMPORT(PyObject *) PyExc_EOFError;
Guido van Rossum7d4266e1997-02-14 22:53:12 +000064extern DL_IMPORT(PyObject *) PyExc_FloatingPointError;
Barry Warsaw62a21a21998-07-23 15:57:34 +000065extern DL_IMPORT(PyObject *) PyExc_EnvironmentError;
Guido van Rossum051ab121995-02-27 10:17:52 +000066extern DL_IMPORT(PyObject *) PyExc_IOError;
Barry Warsaw62a21a21998-07-23 15:57:34 +000067extern DL_IMPORT(PyObject *) PyExc_OSError;
Guido van Rossum051ab121995-02-27 10:17:52 +000068extern DL_IMPORT(PyObject *) PyExc_ImportError;
69extern DL_IMPORT(PyObject *) PyExc_IndexError;
70extern DL_IMPORT(PyObject *) PyExc_KeyError;
71extern DL_IMPORT(PyObject *) PyExc_KeyboardInterrupt;
72extern DL_IMPORT(PyObject *) PyExc_MemoryError;
73extern DL_IMPORT(PyObject *) PyExc_NameError;
74extern DL_IMPORT(PyObject *) PyExc_OverflowError;
75extern DL_IMPORT(PyObject *) PyExc_RuntimeError;
Barry Warsawd052ff01998-12-01 18:34:01 +000076extern DL_IMPORT(PyObject *) PyExc_NotImplementedError;
Guido van Rossum051ab121995-02-27 10:17:52 +000077extern DL_IMPORT(PyObject *) PyExc_SyntaxError;
78extern DL_IMPORT(PyObject *) PyExc_SystemError;
79extern DL_IMPORT(PyObject *) PyExc_SystemExit;
80extern DL_IMPORT(PyObject *) PyExc_TypeError;
Guido van Rossum87460821999-06-22 14:47:32 +000081extern DL_IMPORT(PyObject *) PyExc_UnboundLocalError;
Guido van Rossum99cc9712000-03-10 22:33:32 +000082extern DL_IMPORT(PyObject *) PyExc_UnicodeError;
Guido van Rossum051ab121995-02-27 10:17:52 +000083extern DL_IMPORT(PyObject *) PyExc_ValueError;
84extern DL_IMPORT(PyObject *) PyExc_ZeroDivisionError;
Guido van Rossumdb0c9f72000-02-17 15:17:18 +000085#ifdef MS_WINDOWS
86extern DL_IMPORT(PyObject *) PyExc_WindowsError;
87#endif
Guido van Rossum3e55cb61990-10-21 22:09:30 +000088
Barry Warsaw392d8271997-08-29 21:56:07 +000089extern DL_IMPORT(PyObject *) PyExc_MemoryErrorInst;
90
91
Guido van Rossum5c600e11990-10-14 20:00:25 +000092/* Convenience functions */
93
Guido van Rossum43466ec1998-12-04 18:48:25 +000094extern DL_IMPORT(int) PyErr_BadArgument Py_PROTO((void));
95extern DL_IMPORT(PyObject *) PyErr_NoMemory Py_PROTO((void));
96extern DL_IMPORT(PyObject *) PyErr_SetFromErrno Py_PROTO((PyObject *));
97extern DL_IMPORT(PyObject *) PyErr_SetFromErrnoWithFilename Py_PROTO((PyObject *, char *));
98extern DL_IMPORT(PyObject *) PyErr_Format Py_PROTO((PyObject *, const char *, ...));
Guido van Rossumdb0c9f72000-02-17 15:17:18 +000099#ifdef MS_WINDOWS
100extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErrWithFilename(int, const char *);
101extern DL_IMPORT(PyObject *) PyErr_SetFromWindowsErr(int);
102#endif
Guido van Rossum3e55cb61990-10-21 22:09:30 +0000103
Guido van Rossum43466ec1998-12-04 18:48:25 +0000104extern DL_IMPORT(void) PyErr_BadInternalCall Py_PROTO((void));
Guido van Rossum25831651993-05-19 14:50:45 +0000105
Guido van Rossum2d2c3441997-09-16 21:50:37 +0000106/* Function to create a new exception */
Guido van Rossum43466ec1998-12-04 18:48:25 +0000107DL_IMPORT(PyObject *) PyErr_NewException Py_PROTO((char *name, PyObject *base,
Guido van Rossum2d2c3441997-09-16 21:50:37 +0000108 PyObject *dict));
109
Barry Warsawf3f41a91997-01-03 00:15:03 +0000110/* In sigcheck.c or signalmodule.c */
Guido van Rossum43466ec1998-12-04 18:48:25 +0000111extern DL_IMPORT(int) PyErr_CheckSignals Py_PROTO((void));
112extern DL_IMPORT(void) PyErr_SetInterrupt Py_PROTO((void));
Barry Warsawf3f41a91997-01-03 00:15:03 +0000113
Guido van Rossumb6775db1994-08-01 11:34:53 +0000114
Guido van Rossuma3309961993-07-28 09:05:47 +0000115#ifdef __cplusplus
116}
117#endif
118#endif /* !Py_ERRORS_H */