Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:41

0001 #ifndef Py_CPYTHON_ERRORS_H
0002 #  error "this header file must not be included directly"
0003 #endif
0004 
0005 /* Error objects */
0006 
0007 /* PyException_HEAD defines the initial segment of every exception class. */
0008 #define PyException_HEAD PyObject_HEAD PyObject *dict;\
0009              PyObject *args; PyObject *notes; PyObject *traceback;\
0010              PyObject *context; PyObject *cause;\
0011              char suppress_context;
0012 
0013 typedef struct {
0014     PyException_HEAD
0015 } PyBaseExceptionObject;
0016 
0017 typedef struct {
0018     PyException_HEAD
0019     PyObject *msg;
0020     PyObject *excs;
0021 } PyBaseExceptionGroupObject;
0022 
0023 typedef struct {
0024     PyException_HEAD
0025     PyObject *msg;
0026     PyObject *filename;
0027     PyObject *lineno;
0028     PyObject *offset;
0029     PyObject *end_lineno;
0030     PyObject *end_offset;
0031     PyObject *text;
0032     PyObject *print_file_and_line;
0033 } PySyntaxErrorObject;
0034 
0035 typedef struct {
0036     PyException_HEAD
0037     PyObject *msg;
0038     PyObject *name;
0039     PyObject *path;
0040     PyObject *name_from;
0041 } PyImportErrorObject;
0042 
0043 typedef struct {
0044     PyException_HEAD
0045     PyObject *encoding;
0046     PyObject *object;
0047     Py_ssize_t start;
0048     Py_ssize_t end;
0049     PyObject *reason;
0050 } PyUnicodeErrorObject;
0051 
0052 typedef struct {
0053     PyException_HEAD
0054     PyObject *code;
0055 } PySystemExitObject;
0056 
0057 typedef struct {
0058     PyException_HEAD
0059     PyObject *myerrno;
0060     PyObject *strerror;
0061     PyObject *filename;
0062     PyObject *filename2;
0063 #ifdef MS_WINDOWS
0064     PyObject *winerror;
0065 #endif
0066     Py_ssize_t written;   /* only for BlockingIOError, -1 otherwise */
0067 } PyOSErrorObject;
0068 
0069 typedef struct {
0070     PyException_HEAD
0071     PyObject *value;
0072 } PyStopIterationObject;
0073 
0074 typedef struct {
0075     PyException_HEAD
0076     PyObject *name;
0077 } PyNameErrorObject;
0078 
0079 typedef struct {
0080     PyException_HEAD
0081     PyObject *obj;
0082     PyObject *name;
0083 } PyAttributeErrorObject;
0084 
0085 /* Compatibility typedefs */
0086 typedef PyOSErrorObject PyEnvironmentErrorObject;
0087 #ifdef MS_WINDOWS
0088 typedef PyOSErrorObject PyWindowsErrorObject;
0089 #endif
0090 
0091 /* Error handling definitions */
0092 
0093 PyAPI_FUNC(void) _PyErr_SetKeyError(PyObject *);
0094 PyAPI_FUNC(_PyErr_StackItem*) _PyErr_GetTopmostException(PyThreadState *tstate);
0095 PyAPI_FUNC(PyObject*) _PyErr_GetHandledException(PyThreadState *);
0096 PyAPI_FUNC(void) _PyErr_SetHandledException(PyThreadState *, PyObject *);
0097 PyAPI_FUNC(void) _PyErr_GetExcInfo(PyThreadState *, PyObject **, PyObject **, PyObject **);
0098 
0099 /* Context manipulation (PEP 3134) */
0100 
0101 Py_DEPRECATED(3.12) PyAPI_FUNC(void) _PyErr_ChainExceptions(PyObject *, PyObject *, PyObject *);
0102 PyAPI_FUNC(void) _PyErr_ChainExceptions1(PyObject *);
0103 
0104 /* Like PyErr_Format(), but saves current exception as __context__ and
0105    __cause__.
0106  */
0107 PyAPI_FUNC(PyObject *) _PyErr_FormatFromCause(
0108     PyObject *exception,
0109     const char *format,   /* ASCII-encoded string  */
0110     ...
0111     );
0112 
0113 /* In exceptions.c */
0114 
0115 PyAPI_FUNC(int) _PyException_AddNote(
0116      PyObject *exc,
0117      PyObject *note);
0118 
0119 PyAPI_FUNC(PyObject*) PyUnstable_Exc_PrepReraiseStar(
0120      PyObject *orig,
0121      PyObject *excs);
0122 
0123 /* In signalmodule.c */
0124 
0125 int PySignal_SetWakeupFd(int fd);
0126 PyAPI_FUNC(int) _PyErr_CheckSignals(void);
0127 
0128 /* Support for adding program text to SyntaxErrors */
0129 
0130 PyAPI_FUNC(void) PyErr_SyntaxLocationObject(
0131     PyObject *filename,
0132     int lineno,
0133     int col_offset);
0134 
0135 PyAPI_FUNC(void) PyErr_RangedSyntaxLocationObject(
0136     PyObject *filename,
0137     int lineno,
0138     int col_offset,
0139     int end_lineno,
0140     int end_col_offset);
0141 
0142 PyAPI_FUNC(PyObject *) PyErr_ProgramTextObject(
0143     PyObject *filename,
0144     int lineno);
0145 
0146 PyAPI_FUNC(PyObject *) _PyErr_ProgramDecodedTextObject(
0147     PyObject *filename,
0148     int lineno,
0149     const char* encoding);
0150 
0151 PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create(
0152     PyObject *object,
0153     Py_ssize_t start,
0154     Py_ssize_t end,
0155     const char *reason          /* UTF-8 encoded string */
0156     );
0157 
0158 PyAPI_FUNC(void) _PyErr_WriteUnraisableMsg(
0159     const char *err_msg,
0160     PyObject *obj);
0161 
0162 PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFunc(
0163     const char *func,
0164     const char *message);
0165 
0166 PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalErrorFormat(
0167     const char *func,
0168     const char *format,
0169     ...);
0170 
0171 extern PyObject *_PyErr_SetImportErrorWithNameFrom(
0172         PyObject *,
0173         PyObject *,
0174         PyObject *,
0175         PyObject *);
0176 
0177 
0178 #define Py_FatalError(message) _Py_FatalErrorFunc(__func__, (message))