Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/python3.12/internal/pycore_pyerrors.h
1 #ifndef Py_INTERNAL_PYERRORS_H 2 #define Py_INTERNAL_PYERRORS_H 3 #ifdef __cplusplus 4 extern "C" { 5 #endif 6 7 #ifndef Py_BUILD_CORE 8 # error "this header requires Py_BUILD_CORE define" 9 #endif 10 11 12 /* runtime lifecycle */ 13 14 extern PyStatus _PyErr_InitTypes(PyInterpreterState *); 15 extern void _PyErr_FiniTypes(PyInterpreterState *); 16 17 18 /* other API */ 19 20 static inline PyObject* _PyErr_Occurred(PyThreadState *tstate) 21 { 22 assert(tstate != NULL); 23 if (tstate->current_exception == NULL) { 24 return NULL; 25 } 26 return (PyObject *)Py_TYPE(tstate->current_exception); 27 } 28 29 static inline void _PyErr_ClearExcState(_PyErr_StackItem *exc_state) 30 { 31 Py_CLEAR(exc_state->exc_value); 32 } 33 34 PyAPI_FUNC(PyObject*) _PyErr_StackItemToExcInfoTuple( 35 _PyErr_StackItem *err_info); 36 37 PyAPI_FUNC(void) _PyErr_Fetch( 38 PyThreadState *tstate, 39 PyObject **type, 40 PyObject **value, 41 PyObject **traceback); 42 43 extern PyObject * 44 _PyErr_GetRaisedException(PyThreadState *tstate); 45 46 PyAPI_FUNC(int) _PyErr_ExceptionMatches( 47 PyThreadState *tstate, 48 PyObject *exc); 49 50 void 51 _PyErr_SetRaisedException(PyThreadState *tstate, PyObject *exc); 52 53 PyAPI_FUNC(void) _PyErr_Restore( 54 PyThreadState *tstate, 55 PyObject *type, 56 PyObject *value, 57 PyObject *traceback); 58 59 PyAPI_FUNC(void) _PyErr_SetObject( 60 PyThreadState *tstate, 61 PyObject *type, 62 PyObject *value); 63 64 PyAPI_FUNC(void) _PyErr_ChainStackItem( 65 _PyErr_StackItem *exc_info); 66 67 PyAPI_FUNC(void) _PyErr_Clear(PyThreadState *tstate); 68 69 PyAPI_FUNC(void) _PyErr_SetNone(PyThreadState *tstate, PyObject *exception); 70 71 PyAPI_FUNC(PyObject *) _PyErr_NoMemory(PyThreadState *tstate); 72 73 PyAPI_FUNC(void) _PyErr_SetString( 74 PyThreadState *tstate, 75 PyObject *exception, 76 const char *string); 77 78 /* 79 * Set an exception with the error message decoded from the current locale 80 * encoding (LC_CTYPE). 81 * 82 * Exceptions occurring in decoding take priority over the desired exception. 83 * 84 * Exported for '_ctypes' shared extensions. 85 */ 86 PyAPI_FUNC(void) _PyErr_SetLocaleString( 87 PyObject *exception, 88 const char *string); 89 90 PyAPI_FUNC(PyObject *) _PyErr_Format( 91 PyThreadState *tstate, 92 PyObject *exception, 93 const char *format, 94 ...); 95 96 PyAPI_FUNC(void) _PyErr_NormalizeException( 97 PyThreadState *tstate, 98 PyObject **exc, 99 PyObject **val, 100 PyObject **tb); 101 102 PyAPI_FUNC(PyObject *) _PyErr_FormatFromCauseTstate( 103 PyThreadState *tstate, 104 PyObject *exception, 105 const char *format, 106 ...); 107 108 PyAPI_FUNC(PyObject *) _PyExc_CreateExceptionGroup( 109 const char *msg, 110 PyObject *excs); 111 112 PyAPI_FUNC(PyObject *) _PyExc_PrepReraiseStar( 113 PyObject *orig, 114 PyObject *excs); 115 116 PyAPI_FUNC(int) _PyErr_CheckSignalsTstate(PyThreadState *tstate); 117 118 PyAPI_FUNC(void) _Py_DumpExtensionModules(int fd, PyInterpreterState *interp); 119 120 extern PyObject* _Py_Offer_Suggestions(PyObject* exception); 121 PyAPI_FUNC(Py_ssize_t) _Py_UTF8_Edit_Cost(PyObject *str_a, PyObject *str_b, 122 Py_ssize_t max_cost); 123 124 void _PyErr_FormatNote(const char *format, ...); 125 126 #ifdef __cplusplus 127 } 128 #endif 129 #endif /* !Py_INTERNAL_PYERRORS_H */