| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#ifndef Py_PYERRORS_H |
| 5 |
#define Py_PYERRORS_H |
| 6 |
#ifdef __cplusplus |
| 7 |
extern "C" { |
| 8 |
#endif |
| 9 |
|
| 10 |
#define PyExceptionClass_Check(x) \ |
| 11 |
((PyType_Check((x)) && \ |
| 12 |
PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))) |
| 13 |
|
| 14 |
#define PyExceptionInstance_Check(x) \ |
| 15 |
(PyObject_IsSubclass((PyObject *)Py_TYPE(x), PyExc_BaseException)) |
| 16 |
|
| 17 |
#define PyExc_EnvironmentError PyExc_OSError |
| 18 |
#define PyExc_IOError PyExc_OSError |
| 19 |
|
| 20 |
#ifdef MS_WINDOWS |
| 21 |
#define PyExc_WindowsError PyExc_OSError |
| 22 |
#endif |
| 23 |
|
| 24 |
PyAPI_FUNC(PyObject *) PyErr_NewException(const char *name, PyObject *base, PyObject *dict); |
| 25 |
PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(const char *name, const char *doc, PyObject *base, PyObject *dict); |
| 26 |
PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *exception, const char *format, ...); |
| 27 |
PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause(PyObject *exception, const char *format, ...); |
| 28 |
PyAPI_FUNC(PyObject *) PyErr_FormatV(PyObject *exception, const char *format, va_list vargs); |
| 29 |
|
| 30 |
#include <stdarg.h> |
| 31 |
PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...); |
| 32 |
PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va); |
| 33 |
|
| 34 |
typedef struct { |
| 35 |
PyObject_HEAD |
| 36 |
PyObject *value; |
| 37 |
} PyStopIterationObject; |
| 38 |
|
| 39 |
PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFunc(const char * func, const char *msg); |
| 40 |
|
| 41 |
#define Py_FatalError(message) _Py_FatalErrorFunc(__func__, message) |
| 42 |
|
| 43 |
#ifdef __cplusplus |
| 44 |
} |
| 45 |
#endif |
| 46 |
#endif |