blob: 3be796346e8007e884e0ac461951363d2d08d238 [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 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;
Guido van Rossum051ab121995-02-27 10:17:52 +000065extern DL_IMPORT(PyObject *) PyExc_IOError;
66extern DL_IMPORT(PyObject *) PyExc_ImportError;
67extern DL_IMPORT(PyObject *) PyExc_IndexError;
68extern DL_IMPORT(PyObject *) PyExc_KeyError;
69extern DL_IMPORT(PyObject *) PyExc_KeyboardInterrupt;
70extern DL_IMPORT(PyObject *) PyExc_MemoryError;
71extern DL_IMPORT(PyObject *) PyExc_NameError;
72extern DL_IMPORT(PyObject *) PyExc_OverflowError;
73extern DL_IMPORT(PyObject *) PyExc_RuntimeError;
74extern DL_IMPORT(PyObject *) PyExc_SyntaxError;
75extern DL_IMPORT(PyObject *) PyExc_SystemError;
76extern DL_IMPORT(PyObject *) PyExc_SystemExit;
77extern DL_IMPORT(PyObject *) PyExc_TypeError;
78extern DL_IMPORT(PyObject *) PyExc_ValueError;
79extern DL_IMPORT(PyObject *) PyExc_ZeroDivisionError;
Guido van Rossum3e55cb61990-10-21 22:09:30 +000080
Barry Warsaw392d8271997-08-29 21:56:07 +000081extern DL_IMPORT(PyObject *) PyExc_MemoryErrorInst;
82
83
Guido van Rossum5c600e11990-10-14 20:00:25 +000084/* Convenience functions */
85
Guido van Rossumcaa63801995-01-12 11:45:45 +000086extern int PyErr_BadArgument Py_PROTO((void));
87extern PyObject *PyErr_NoMemory Py_PROTO((void));
88extern PyObject *PyErr_SetFromErrno Py_PROTO((PyObject *));
Guido van Rossumc4193f11997-02-14 17:10:25 +000089extern PyObject *PyErr_Format Py_PROTO((PyObject *, const char *, ...));
Guido van Rossum3e55cb61990-10-21 22:09:30 +000090
Guido van Rossumcaa63801995-01-12 11:45:45 +000091extern void PyErr_BadInternalCall Py_PROTO((void));
Guido van Rossum25831651993-05-19 14:50:45 +000092
Guido van Rossum2d2c3441997-09-16 21:50:37 +000093/* Function to create a new exception */
94PyObject *PyErr_NewException Py_PROTO((char *name, PyObject *base,
95 PyObject *dict));
96
Barry Warsawf3f41a91997-01-03 00:15:03 +000097/* In sigcheck.c or signalmodule.c */
98extern int PyErr_CheckSignals Py_PROTO((void));
99extern void PyErr_SetInterrupt Py_PROTO((void));
100
Guido van Rossumb6775db1994-08-01 11:34:53 +0000101
Guido van Rossuma3309961993-07-28 09:05:47 +0000102#ifdef __cplusplus
103}
104#endif
105#endif /* !Py_ERRORS_H */