1#ifndef Py_INTERNAL_PYERRORS_H
2#define Py_INTERNAL_PYERRORS_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7#ifndef Py_BUILD_CORE
8# error "this header requires Py_BUILD_CORE define"
9#endif
10
11static inline PyObject* _PyErr_Occurred(PyThreadState *tstate)
12{
13 assert(tstate != NULL);
14 return tstate->curexc_type;
15}
16
17static inline void _PyErr_ClearExcState(_PyErr_StackItem *exc_state)
18{
19 PyObject *t, *v, *tb;
20 t = exc_state->exc_type;
21 v = exc_state->exc_value;
22 tb = exc_state->exc_traceback;
23 exc_state->exc_type = NULL;
24 exc_state->exc_value = NULL;
25 exc_state->exc_traceback = NULL;
26 Py_XDECREF(t);
27 Py_XDECREF(v);
28 Py_XDECREF(tb);
29}
30
31
32PyAPI_FUNC(void) _PyErr_Fetch(
33 PyThreadState *tstate,
34 PyObject **type,
35 PyObject **value,
36 PyObject **traceback);
37
38PyAPI_FUNC(int) _PyErr_ExceptionMatches(
39 PyThreadState *tstate,
40 PyObject *exc);
41
42PyAPI_FUNC(void) _PyErr_Restore(
43 PyThreadState *tstate,
44 PyObject *type,
45 PyObject *value,
46 PyObject *traceback);
47
48PyAPI_FUNC(void) _PyErr_SetObject(
49 PyThreadState *tstate,
50 PyObject *type,
51 PyObject *value);
52
53PyAPI_FUNC(void) _PyErr_ChainStackItem(
54 _PyErr_StackItem *exc_info);
55
56PyAPI_FUNC(void) _PyErr_Clear(PyThreadState *tstate);
57
58PyAPI_FUNC(void) _PyErr_SetNone(PyThreadState *tstate, PyObject *exception);
59
60PyAPI_FUNC(PyObject *) _PyErr_NoMemory(PyThreadState *tstate);
61
62PyAPI_FUNC(void) _PyErr_SetString(
63 PyThreadState *tstate,
64 PyObject *exception,
65 const char *string);
66
67PyAPI_FUNC(PyObject *) _PyErr_Format(
68 PyThreadState *tstate,
69 PyObject *exception,
70 const char *format,
71 ...);
72
73PyAPI_FUNC(void) _PyErr_NormalizeException(
74 PyThreadState *tstate,
75 PyObject **exc,
76 PyObject **val,
77 PyObject **tb);
78
79PyAPI_FUNC(PyObject *) _PyErr_FormatFromCauseTstate(
80 PyThreadState *tstate,
81 PyObject *exception,
82 const char *format,
83 ...);
84
85PyAPI_FUNC(int) _PyErr_CheckSignalsTstate(PyThreadState *tstate);
86
87PyAPI_FUNC(void) _Py_DumpExtensionModules(int fd, PyInterpreterState *interp);
88
89extern PyObject* _Py_Offer_Suggestions(PyObject* exception);
90PyAPI_FUNC(Py_ssize_t) _Py_UTF8_Edit_Cost(PyObject *str_a, PyObject *str_b,
91 Py_ssize_t max_cost);
92
93#ifdef __cplusplus
94}
95#endif
96#endif /* !Py_INTERNAL_PYERRORS_H */
97