File indexing completed on 2025-01-18 10:06:46
0001 #ifndef Py_INTERNAL_PYERRORS_H
0002 #define Py_INTERNAL_PYERRORS_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006
0007 #ifndef Py_BUILD_CORE
0008 # error "this header requires Py_BUILD_CORE define"
0009 #endif
0010
0011
0012
0013
0014 extern PyStatus _PyErr_InitTypes(PyInterpreterState *);
0015 extern void _PyErr_FiniTypes(PyInterpreterState *);
0016
0017
0018
0019
0020 static inline PyObject* _PyErr_Occurred(PyThreadState *tstate)
0021 {
0022 assert(tstate != NULL);
0023 if (tstate->current_exception == NULL) {
0024 return NULL;
0025 }
0026 return (PyObject *)Py_TYPE(tstate->current_exception);
0027 }
0028
0029 static inline void _PyErr_ClearExcState(_PyErr_StackItem *exc_state)
0030 {
0031 Py_CLEAR(exc_state->exc_value);
0032 }
0033
0034 PyAPI_FUNC(PyObject*) _PyErr_StackItemToExcInfoTuple(
0035 _PyErr_StackItem *err_info);
0036
0037 PyAPI_FUNC(void) _PyErr_Fetch(
0038 PyThreadState *tstate,
0039 PyObject **type,
0040 PyObject **value,
0041 PyObject **traceback);
0042
0043 extern PyObject *
0044 _PyErr_GetRaisedException(PyThreadState *tstate);
0045
0046 PyAPI_FUNC(int) _PyErr_ExceptionMatches(
0047 PyThreadState *tstate,
0048 PyObject *exc);
0049
0050 void
0051 _PyErr_SetRaisedException(PyThreadState *tstate, PyObject *exc);
0052
0053 PyAPI_FUNC(void) _PyErr_Restore(
0054 PyThreadState *tstate,
0055 PyObject *type,
0056 PyObject *value,
0057 PyObject *traceback);
0058
0059 PyAPI_FUNC(void) _PyErr_SetObject(
0060 PyThreadState *tstate,
0061 PyObject *type,
0062 PyObject *value);
0063
0064 PyAPI_FUNC(void) _PyErr_ChainStackItem(
0065 _PyErr_StackItem *exc_info);
0066
0067 PyAPI_FUNC(void) _PyErr_Clear(PyThreadState *tstate);
0068
0069 PyAPI_FUNC(void) _PyErr_SetNone(PyThreadState *tstate, PyObject *exception);
0070
0071 PyAPI_FUNC(PyObject *) _PyErr_NoMemory(PyThreadState *tstate);
0072
0073 PyAPI_FUNC(void) _PyErr_SetString(
0074 PyThreadState *tstate,
0075 PyObject *exception,
0076 const char *string);
0077
0078 PyAPI_FUNC(PyObject *) _PyErr_Format(
0079 PyThreadState *tstate,
0080 PyObject *exception,
0081 const char *format,
0082 ...);
0083
0084 PyAPI_FUNC(void) _PyErr_NormalizeException(
0085 PyThreadState *tstate,
0086 PyObject **exc,
0087 PyObject **val,
0088 PyObject **tb);
0089
0090 PyAPI_FUNC(PyObject *) _PyErr_FormatFromCauseTstate(
0091 PyThreadState *tstate,
0092 PyObject *exception,
0093 const char *format,
0094 ...);
0095
0096 PyAPI_FUNC(PyObject *) _PyExc_CreateExceptionGroup(
0097 const char *msg,
0098 PyObject *excs);
0099
0100 PyAPI_FUNC(PyObject *) _PyExc_PrepReraiseStar(
0101 PyObject *orig,
0102 PyObject *excs);
0103
0104 PyAPI_FUNC(int) _PyErr_CheckSignalsTstate(PyThreadState *tstate);
0105
0106 PyAPI_FUNC(void) _Py_DumpExtensionModules(int fd, PyInterpreterState *interp);
0107
0108 extern PyObject* _Py_Offer_Suggestions(PyObject* exception);
0109 PyAPI_FUNC(Py_ssize_t) _Py_UTF8_Edit_Cost(PyObject *str_a, PyObject *str_b,
0110 Py_ssize_t max_cost);
0111
0112 void _PyErr_FormatNote(const char *format, ...);
0113
0114 #ifdef __cplusplus
0115 }
0116 #endif
0117 #endif