vidya7732/AI_Doctor_LLM_GenModel
0
1#ifndef Py_CPYTHON_ERRORS_H2# error "this header file must not be included directly"3#endif4 5#ifdef __cplusplus6extern "C" {7#endif8 9/* Error objects */10 11/* PyException_HEAD defines the initial segment of every exception class. */12#define PyException_HEAD PyObject_HEAD PyObject *dict;\13 PyObject *args; PyObject *traceback;\14 PyObject *context; PyObject *cause;\15 char suppress_context;16 17typedef struct {18 PyException_HEAD19} PyBaseExceptionObject;20 21typedef struct {22 PyException_HEAD23 PyObject *msg;24 PyObject *filename;25 PyObject *lineno;26 PyObject *offset;27 PyObject *text;28 PyObject *print_file_and_line;29} PySyntaxErrorObject;30 31typedef struct {32 PyException_HEAD33 PyObject *msg;34 PyObject *name;35 PyObject *path;36} PyImportErrorObject;37 38typedef struct {39 PyException_HEAD40 PyObject *encoding;41 PyObject *object;42 Py_ssize_t start;43 Py_ssize_t end;44 PyObject *reason;45} PyUnicodeErrorObject;46 47typedef struct {48 PyException_HEAD49 PyObject *code;50} PySystemExitObject;51 52typedef struct {53 PyException_HEAD54 PyObject *myerrno;55 PyObject *strerror;56 PyObject *filename;57 PyObject *filename2;58#ifdef MS_WINDOWS59 PyObject *winerror;60#endif61 Py_ssize_t written; /* only for BlockingIOError, -1 otherwise */62} PyOSErrorObject;63 64typedef struct {65 PyException_HEAD66 PyObject *value;67} PyStopIterationObject;68 69/* Compatibility typedefs */70typedef PyOSErrorObject PyEnvironmentErrorObject;71#ifdef MS_WINDOWS72typedef PyOSErrorObject PyWindowsErrorObject;73#endif74 75/* Error handling definitions */76 77PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *);78PyAPI_FUNC(_PyErr_StackItem*) _PyErr_GetTopmostException(PyThreadState *tstate);79PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, PyObject **);80 81/* Context manipulation (PEP 3134) */82 83PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);84 85/* */86 87#define PyExceptionClass_Name(x) (((PyTypeObject*)(x))->tp_name)88 89/* Convenience functions */90 91#ifdef MS_WINDOWS92Py_DEPRECATED(3.3)93PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(94 PyObject *, const Py_UNICODE *);95#endif /* MS_WINDOWS */96 97/* Like PyErr_Format(), but saves current exception as __context__ and98 __cause__.99 */100PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause(101 PyObject *exception,102 const char *format, /* ASCII-encoded string */103 ...104 );105 106#ifdef MS_WINDOWS107/* XXX redeclare to use WSTRING */108Py_DEPRECATED(3.3)109PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(110 int, const Py_UNICODE *);111Py_DEPRECATED(3.3)112PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(113 PyObject *,int, const Py_UNICODE *);114#endif115 116/* In exceptions.c */117 118/* Helper that attempts to replace the current exception with one of the119 * same type but with a prefix added to the exception text. The resulting120 * exception description looks like:121 *122 * prefix (exc_type: original_exc_str)123 *124 * Only some exceptions can be safely replaced. If the function determines125 * it isn't safe to perform the replacement, it will leave the original126 * unmodified exception in place.127 *128 * Returns a borrowed reference to the new exception (if any), NULL if the129 * existing exception was left in place.130 */131PyAPI_FUNC(PyObject *) _PyErr_TrySetFromCause(132 const char *prefix_format, /* ASCII-encoded string */133 ...134 );135 136/* In signalmodule.c */137 138int PySignal_SetWakeupFd(int fd);139PyAPI_FUNC(int) _PyErr_CheckSignals(void);140 141/* Support for adding program text to SyntaxErrors */142 143PyAPI_FUNC(void) PyErr_SyntaxLocationObject(144 PyObject *filename,145 int lineno,146 int col_offset);147 148PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(149 PyObject *filename,150 int lineno);151 152/* Create a UnicodeEncodeError object.153 *154 * TODO: This API will be removed in Python 3.11.155 */156Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create(157 const char *encoding, /* UTF-8 encoded string */158 const Py_UNICODE *object,159 Py_ssize_t length,160 Py_ssize_t start,161 Py_ssize_t end,162 const char *reason /* UTF-8 encoded string */163 );164 165/* Create a UnicodeTranslateError object.166 *167 * TODO: This API will be removed in Python 3.11.168 */169Py_DEPRECATED(3.3) PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(170 const Py_UNICODE *object,171 Py_ssize_t length,172 Py_ssize_t start,173 Py_ssize_t end,174 const char *reason /* UTF-8 encoded string */175 );176PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create(177 PyObject *object,178 Py_ssize_t start,179 Py_ssize_t end,180 const char *reason /* UTF-8 encoded string */181 );182 183PyAPI_FUNC(void) _PyErr_WriteUnraisableMsg(184 const char *err_msg,185 PyObject *obj);186 187PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFunc(188 const char *func,189 const char *message);190 191PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFormat(192 const char *func,193 const char *format,194 ...);195 196#define Py_FatalError(message) _Py_FatalErrorFunc(__func__, message)197 198#ifdef __cplusplus199}200#endif201 