blob: 45e8042f136d2bebecb3c56f4f8b3a519594cc0e [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 Rossumcaa63801995-01-12 11:45:45 +000040void PyErr_SetNone Py_PROTO((PyObject *));
41void PyErr_SetObject Py_PROTO((PyObject *, PyObject *));
Guido van Rossum067998f1996-12-10 15:33:34 +000042void PyErr_SetString Py_PROTO((PyObject *, const char *));
Guido van Rossumcaa63801995-01-12 11:45:45 +000043PyObject *PyErr_Occurred Py_PROTO((void));
44void PyErr_Clear Py_PROTO((void));
45void PyErr_Fetch Py_PROTO((PyObject **, PyObject **, PyObject **));
46void 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 */
49int PyErr_GivenExceptionMatches Py_PROTO((PyObject *, PyObject *));
50int PyErr_ExceptionMatches Py_PROTO((PyObject *));
51void PyErr_NormalizeException Py_PROTO((PyObject**, PyObject**, PyObject**));
52
53
Guido van Rossum3f5da241990-12-20 15:06:42 +000054/* Predefined exceptions */
Guido van Rossum5c600e11990-10-14 20:00:25 +000055
Guido van Rossum051ab121995-02-27 10:17:52 +000056extern DL_IMPORT(PyObject *) PyExc_AccessError;
Guido van Rossum6fa44661997-04-02 05:22:53 +000057extern DL_IMPORT(PyObject *) PyExc_AssertionError;
Guido van Rossum051ab121995-02-27 10:17:52 +000058extern DL_IMPORT(PyObject *) PyExc_AttributeError;
Guido van Rossum051ab121995-02-27 10:17:52 +000059extern DL_IMPORT(PyObject *) PyExc_EOFError;
Guido van Rossum7d4266e1997-02-14 22:53:12 +000060extern DL_IMPORT(PyObject *) PyExc_FloatingPointError;
Guido van Rossum051ab121995-02-27 10:17:52 +000061extern DL_IMPORT(PyObject *) PyExc_IOError;
62extern DL_IMPORT(PyObject *) PyExc_ImportError;
63extern DL_IMPORT(PyObject *) PyExc_IndexError;
64extern DL_IMPORT(PyObject *) PyExc_KeyError;
65extern DL_IMPORT(PyObject *) PyExc_KeyboardInterrupt;
66extern DL_IMPORT(PyObject *) PyExc_MemoryError;
67extern DL_IMPORT(PyObject *) PyExc_NameError;
68extern DL_IMPORT(PyObject *) PyExc_OverflowError;
69extern DL_IMPORT(PyObject *) PyExc_RuntimeError;
70extern DL_IMPORT(PyObject *) PyExc_SyntaxError;
71extern DL_IMPORT(PyObject *) PyExc_SystemError;
72extern DL_IMPORT(PyObject *) PyExc_SystemExit;
73extern DL_IMPORT(PyObject *) PyExc_TypeError;
74extern DL_IMPORT(PyObject *) PyExc_ValueError;
75extern DL_IMPORT(PyObject *) PyExc_ZeroDivisionError;
Guido van Rossum3e55cb61990-10-21 22:09:30 +000076
Guido van Rossum5c600e11990-10-14 20:00:25 +000077/* Convenience functions */
78
Guido van Rossumcaa63801995-01-12 11:45:45 +000079extern int PyErr_BadArgument Py_PROTO((void));
80extern PyObject *PyErr_NoMemory Py_PROTO((void));
81extern PyObject *PyErr_SetFromErrno Py_PROTO((PyObject *));
Guido van Rossumc4193f11997-02-14 17:10:25 +000082extern PyObject *PyErr_Format Py_PROTO((PyObject *, const char *, ...));
Guido van Rossum3e55cb61990-10-21 22:09:30 +000083
Guido van Rossumcaa63801995-01-12 11:45:45 +000084extern void PyErr_BadInternalCall Py_PROTO((void));
Guido van Rossum25831651993-05-19 14:50:45 +000085
Barry Warsawf3f41a91997-01-03 00:15:03 +000086/* In sigcheck.c or signalmodule.c */
87extern int PyErr_CheckSignals Py_PROTO((void));
88extern void PyErr_SetInterrupt Py_PROTO((void));
89
Guido van Rossumb6775db1994-08-01 11:34:53 +000090
Guido van Rossuma3309961993-07-28 09:05:47 +000091#ifdef __cplusplus
92}
93#endif
94#endif /* !Py_ERRORS_H */