CoolFace
Apppublic

vidya7732/AI_Doctor_LLM_GenModel

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
pyerrors.h327 linesDownload Raw Back to include
1#ifndef Py_ERRORS_H2#define Py_ERRORS_H3#ifdef __cplusplus4extern "C" {5#endif6 7#include <stdarg.h>               // va_list8 9/* Error handling definitions */10 11PyAPI_FUNC(void) PyErr_SetNone(PyObject *);12PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *);13PyAPI_FUNC(void) PyErr_SetString(14    PyObject *exception,15    const char *string   /* decoded from utf-8 */16    );17PyAPI_FUNC(PyObject *) PyErr_Occurred(void);18PyAPI_FUNC(void) PyErr_Clear(void);19PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **);20PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *);21#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x0303000022PyAPI_FUNC(void) PyErr_GetExcInfo(PyObject **, PyObject **, PyObject **);23PyAPI_FUNC(void) PyErr_SetExcInfo(PyObject *, PyObject *, PyObject *);24#endif25 26/* Defined in Python/pylifecycle.c27 28   The Py_FatalError() function is replaced with a macro which logs29   automatically the name of the current function, unless the Py_LIMITED_API30   macro is defined. */31PyAPI_FUNC(void) _Py_NO_RETURN Py_FatalError(const char *message);32 33#if defined(Py_DEBUG) || defined(Py_LIMITED_API)34#define _PyErr_OCCURRED() PyErr_Occurred()35#else36#define _PyErr_OCCURRED() (PyThreadState_GET()->curexc_type)37#endif38 39/* Error testing and normalization */40PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *);41PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *);42PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);43 44/* Traceback manipulation (PEP 3134) */45PyAPI_FUNC(int) PyException_SetTraceback(PyObject *, PyObject *);46PyAPI_FUNC(PyObject *) PyException_GetTraceback(PyObject *);47 48/* Cause manipulation (PEP 3134) */49PyAPI_FUNC(PyObject *) PyException_GetCause(PyObject *);50PyAPI_FUNC(void) PyException_SetCause(PyObject *, PyObject *);51 52/* Context manipulation (PEP 3134) */53PyAPI_FUNC(PyObject *) PyException_GetContext(PyObject *);54PyAPI_FUNC(void) PyException_SetContext(PyObject *, PyObject *);55 56/* */57 58#define PyExceptionClass_Check(x)                                       \59    (PyType_Check((x)) &&                                               \60     PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))61 62#define PyExceptionInstance_Check(x)                    \63    PyType_FastSubclass(Py_TYPE(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)64 65PyAPI_FUNC(const char *) PyExceptionClass_Name(PyObject *);66 67#define PyExceptionInstance_Class(x) ((PyObject*)Py_TYPE(x))68 69 70/* Predefined exceptions */71 72PyAPI_DATA(PyObject *) PyExc_BaseException;73PyAPI_DATA(PyObject *) PyExc_Exception;74#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x0305000075PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration;76#endif77PyAPI_DATA(PyObject *) PyExc_StopIteration;78PyAPI_DATA(PyObject *) PyExc_GeneratorExit;79PyAPI_DATA(PyObject *) PyExc_ArithmeticError;80PyAPI_DATA(PyObject *) PyExc_LookupError;81 82PyAPI_DATA(PyObject *) PyExc_AssertionError;83PyAPI_DATA(PyObject *) PyExc_AttributeError;84PyAPI_DATA(PyObject *) PyExc_BufferError;85PyAPI_DATA(PyObject *) PyExc_EOFError;86PyAPI_DATA(PyObject *) PyExc_FloatingPointError;87PyAPI_DATA(PyObject *) PyExc_OSError;88PyAPI_DATA(PyObject *) PyExc_ImportError;89#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x0306000090PyAPI_DATA(PyObject *) PyExc_ModuleNotFoundError;91#endif92PyAPI_DATA(PyObject *) PyExc_IndexError;93PyAPI_DATA(PyObject *) PyExc_KeyError;94PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt;95PyAPI_DATA(PyObject *) PyExc_MemoryError;96PyAPI_DATA(PyObject *) PyExc_NameError;97PyAPI_DATA(PyObject *) PyExc_OverflowError;98PyAPI_DATA(PyObject *) PyExc_RuntimeError;99#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000100PyAPI_DATA(PyObject *) PyExc_RecursionError;101#endif102PyAPI_DATA(PyObject *) PyExc_NotImplementedError;103PyAPI_DATA(PyObject *) PyExc_SyntaxError;104PyAPI_DATA(PyObject *) PyExc_IndentationError;105PyAPI_DATA(PyObject *) PyExc_TabError;106PyAPI_DATA(PyObject *) PyExc_ReferenceError;107PyAPI_DATA(PyObject *) PyExc_SystemError;108PyAPI_DATA(PyObject *) PyExc_SystemExit;109PyAPI_DATA(PyObject *) PyExc_TypeError;110PyAPI_DATA(PyObject *) PyExc_UnboundLocalError;111PyAPI_DATA(PyObject *) PyExc_UnicodeError;112PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError;113PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError;114PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError;115PyAPI_DATA(PyObject *) PyExc_ValueError;116PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError;117 118#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000119PyAPI_DATA(PyObject *) PyExc_BlockingIOError;120PyAPI_DATA(PyObject *) PyExc_BrokenPipeError;121PyAPI_DATA(PyObject *) PyExc_ChildProcessError;122PyAPI_DATA(PyObject *) PyExc_ConnectionError;123PyAPI_DATA(PyObject *) PyExc_ConnectionAbortedError;124PyAPI_DATA(PyObject *) PyExc_ConnectionRefusedError;125PyAPI_DATA(PyObject *) PyExc_ConnectionResetError;126PyAPI_DATA(PyObject *) PyExc_FileExistsError;127PyAPI_DATA(PyObject *) PyExc_FileNotFoundError;128PyAPI_DATA(PyObject *) PyExc_InterruptedError;129PyAPI_DATA(PyObject *) PyExc_IsADirectoryError;130PyAPI_DATA(PyObject *) PyExc_NotADirectoryError;131PyAPI_DATA(PyObject *) PyExc_PermissionError;132PyAPI_DATA(PyObject *) PyExc_ProcessLookupError;133PyAPI_DATA(PyObject *) PyExc_TimeoutError;134#endif135 136 137/* Compatibility aliases */138PyAPI_DATA(PyObject *) PyExc_EnvironmentError;139PyAPI_DATA(PyObject *) PyExc_IOError;140#ifdef MS_WINDOWS141PyAPI_DATA(PyObject *) PyExc_WindowsError;142#endif143 144/* Predefined warning categories */145PyAPI_DATA(PyObject *) PyExc_Warning;146PyAPI_DATA(PyObject *) PyExc_UserWarning;147PyAPI_DATA(PyObject *) PyExc_DeprecationWarning;148PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning;149PyAPI_DATA(PyObject *) PyExc_SyntaxWarning;150PyAPI_DATA(PyObject *) PyExc_RuntimeWarning;151PyAPI_DATA(PyObject *) PyExc_FutureWarning;152PyAPI_DATA(PyObject *) PyExc_ImportWarning;153PyAPI_DATA(PyObject *) PyExc_UnicodeWarning;154PyAPI_DATA(PyObject *) PyExc_BytesWarning;155PyAPI_DATA(PyObject *) PyExc_ResourceWarning;156 157 158/* Convenience functions */159 160PyAPI_FUNC(int) PyErr_BadArgument(void);161PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);162PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);163PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(164    PyObject *, PyObject *);165#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000166PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObjects(167    PyObject *, PyObject *, PyObject *);168#endif169PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(170    PyObject *exc,171    const char *filename   /* decoded from the filesystem encoding */172    );173 174PyAPI_FUNC(PyObject *) PyErr_Format(175    PyObject *exception,176    const char *format,   /* ASCII-encoded string  */177    ...178    );179#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000180PyAPI_FUNC(PyObject *) PyErr_FormatV(181    PyObject *exception,182    const char *format,183    va_list vargs);184#endif185 186#ifdef MS_WINDOWS187PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(188    int ierr,189    const char *filename        /* decoded from the filesystem encoding */190    );191PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);192PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(193    PyObject *,int, PyObject *);194#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000195PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObjects(196    PyObject *,int, PyObject *, PyObject *);197#endif198PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(199    PyObject *exc,200    int ierr,201    const char *filename        /* decoded from the filesystem encoding */202    );203PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);204#endif /* MS_WINDOWS */205 206#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03060000207PyAPI_FUNC(PyObject *) PyErr_SetImportErrorSubclass(PyObject *, PyObject *,208    PyObject *, PyObject *);209#endif210#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000211PyAPI_FUNC(PyObject *) PyErr_SetImportError(PyObject *, PyObject *,212    PyObject *);213#endif214 215/* Export the old function so that the existing API remains available: */216PyAPI_FUNC(void) PyErr_BadInternalCall(void);217PyAPI_FUNC(void) _PyErr_BadInternalCall(const char *filename, int lineno);218/* Mask the old API with a call to the new API for code compiled under219   Python 2.0: */220#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)221 222/* Function to create a new exception */223PyAPI_FUNC(PyObject *) PyErr_NewException(224    const char *name, PyObject *base, PyObject *dict);225PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc(226    const char *name, const char *doc, PyObject *base, PyObject *dict);227PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *);228 229 230/* In signalmodule.c */231PyAPI_FUNC(int) PyErr_CheckSignals(void);232PyAPI_FUNC(void) PyErr_SetInterrupt(void);233 234/* Support for adding program text to SyntaxErrors */235PyAPI_FUNC(void) PyErr_SyntaxLocation(236    const char *filename,       /* decoded from the filesystem encoding */237    int lineno);238PyAPI_FUNC(void) PyErr_SyntaxLocationEx(239    const char *filename,       /* decoded from the filesystem encoding */240    int lineno,241    int col_offset);242PyAPI_FUNC(PyObject *) PyErr_ProgramText(243    const char *filename,       /* decoded from the filesystem encoding */244    int lineno);245 246/* The following functions are used to create and modify unicode247   exceptions from C */248 249/* create a UnicodeDecodeError object */250PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create(251    const char *encoding,       /* UTF-8 encoded string */252    const char *object,253    Py_ssize_t length,254    Py_ssize_t start,255    Py_ssize_t end,256    const char *reason          /* UTF-8 encoded string */257    );258 259/* get the encoding attribute */260PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *);261PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *);262 263/* get the object attribute */264PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *);265PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *);266PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *);267 268/* get the value of the start attribute (the int * may not be NULL)269   return 0 on success, -1 on failure */270PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *);271PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *);272PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *);273 274/* assign a new value to the start attribute275   return 0 on success, -1 on failure */276PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t);277PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t);278PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t);279 280/* get the value of the end attribute (the int *may not be NULL)281 return 0 on success, -1 on failure */282PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *);283PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *);284PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *);285 286/* assign a new value to the end attribute287   return 0 on success, -1 on failure */288PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t);289PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t);290PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t);291 292/* get the value of the reason attribute */293PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *);294PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *);295PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *);296 297/* assign a new value to the reason attribute298   return 0 on success, -1 on failure */299PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason(300    PyObject *exc,301    const char *reason          /* UTF-8 encoded string */302    );303PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason(304    PyObject *exc,305    const char *reason          /* UTF-8 encoded string */306    );307PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason(308    PyObject *exc,309    const char *reason          /* UTF-8 encoded string */310    );311 312PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char  *format, ...)313                        Py_GCC_ATTRIBUTE((format(printf, 3, 4)));314PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char  *format, va_list va)315                        Py_GCC_ATTRIBUTE((format(printf, 3, 0)));316 317#ifndef Py_LIMITED_API318#  define Py_CPYTHON_ERRORS_H319#  include  "cpython/pyerrors.h"320#  undef Py_CPYTHON_ERRORS_H321#endif322 323#ifdef __cplusplus324}325#endif326#endif /* !Py_ERRORS_H */327