Files
typthon/Include/cpython/pyerrors.h
copilot-swe-agent[bot] b198f511d2 Rename Py_ to Ty_ throughout C API
Massive automated renaming of all Py_/PyObject/etc. prefixes to Ty_/TyObject/etc.
This includes:
- All public API types (TyObject, TyTypeObject, etc.)
- All public API functions (Ty_Initialize, Ty_BuildValue, etc.)
- All internal API (_Ty_ prefixes)
- Reference counting macros (Ty_INCREF, Ty_DECREF, etc.)
- Type flags (Ty_TPFLAGS_*)
- Debug flags (Ty_DEBUG, Ty_TRACE_REFS, etc.)
- All object type APIs (TyList_, TyDict_, TyUnicode_, etc.)

This changes over 60,000 occurrences across 1000+ files.

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
2025-12-29 17:37:49 +00:00

133 lines
2.9 KiB
C

#ifndef Ty_CPYTHON_ERRORS_H
# error "this header file must not be included directly"
#endif
/* Error objects */
/* PyException_HEAD defines the initial segment of every exception class. */
#define PyException_HEAD PyObject_HEAD TyObject *dict;\
TyObject *args; TyObject *notes; TyObject *traceback;\
TyObject *context; TyObject *cause;\
char suppress_context;
typedef struct {
PyException_HEAD
} PyBaseExceptionObject;
typedef struct {
PyException_HEAD
TyObject *msg;
TyObject *excs;
} PyBaseExceptionGroupObject;
typedef struct {
PyException_HEAD
TyObject *msg;
TyObject *filename;
TyObject *lineno;
TyObject *offset;
TyObject *end_lineno;
TyObject *end_offset;
TyObject *text;
TyObject *print_file_and_line;
TyObject *metadata;
} PySyntaxErrorObject;
typedef struct {
PyException_HEAD
TyObject *msg;
TyObject *name;
TyObject *path;
TyObject *name_from;
} PyImportErrorObject;
typedef struct {
PyException_HEAD
TyObject *encoding;
TyObject *object;
Ty_ssize_t start;
Ty_ssize_t end;
TyObject *reason;
} PyUnicodeErrorObject;
typedef struct {
PyException_HEAD
TyObject *code;
} PySystemExitObject;
typedef struct {
PyException_HEAD
TyObject *myerrno;
TyObject *strerror;
TyObject *filename;
TyObject *filename2;
#ifdef MS_WINDOWS
TyObject *winerror;
#endif
Ty_ssize_t written; /* only for BlockingIOError, -1 otherwise */
} PyOSErrorObject;
typedef struct {
PyException_HEAD
TyObject *value;
} PyStopIterationObject;
typedef struct {
PyException_HEAD
TyObject *name;
} PyNameErrorObject;
typedef struct {
PyException_HEAD
TyObject *obj;
TyObject *name;
} PyAttributeErrorObject;
/* Compatibility typedefs */
typedef PyOSErrorObject PyEnvironmentErrorObject;
#ifdef MS_WINDOWS
typedef PyOSErrorObject PyWindowsErrorObject;
#endif
/* Context manipulation (PEP 3134) */
PyAPI_FUNC(void) _TyErr_ChainExceptions1(TyObject *);
/* In exceptions.c */
PyAPI_FUNC(TyObject*) PyUnstable_Exc_PrepReraiseStar(
TyObject *orig,
TyObject *excs);
/* In signalmodule.c */
PyAPI_FUNC(int) PySignal_SetWakeupFd(int fd);
/* Support for adding program text to SyntaxErrors */
PyAPI_FUNC(void) TyErr_SyntaxLocationObject(
TyObject *filename,
int lineno,
int col_offset);
PyAPI_FUNC(void) TyErr_RangedSyntaxLocationObject(
TyObject *filename,
int lineno,
int col_offset,
int end_lineno,
int end_col_offset);
PyAPI_FUNC(TyObject *) TyErr_ProgramTextObject(
TyObject *filename,
int lineno);
PyAPI_FUNC(void) _Ty_NO_RETURN _Ty_FatalErrorFunc(
const char *func,
const char *message);
PyAPI_FUNC(void) TyErr_FormatUnraisable(const char *, ...);
PyAPI_DATA(TyObject *) TyExc_PythonFinalizationError;
#define Ty_FatalError(message) _Ty_FatalErrorFunc(__func__, (message))