#include <Python.h>
#include <stdbool.h>
#include "pycore_abstract.h"
#include "pycore_ceval.h"
#include "pycore_exceptions.h"
#include "pycore_initconfig.h"
#include "pycore_modsupport.h"
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "osdefs.h"
PyObject *PyExc_EnvironmentError = …;
PyObject *PyExc_IOError = …;
#ifdef MS_WINDOWS
PyObject *PyExc_WindowsError = NULL;
#endif
static struct _Py_exc_state*
get_exc_state(void)
{ … }
static PyObject *
BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{ … }
static int
BaseException_init(PyBaseExceptionObject *self, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
BaseException_vectorcall(PyObject *type_obj, PyObject * const*args,
size_t nargsf, PyObject *kwnames)
{ … }
static int
BaseException_clear(PyBaseExceptionObject *self)
{ … }
static void
BaseException_dealloc(PyBaseExceptionObject *self)
{ … }
static int
BaseException_traverse(PyBaseExceptionObject *self, visitproc visit, void *arg)
{ … }
static PyObject *
BaseException_str(PyBaseExceptionObject *self)
{ … }
static PyObject *
BaseException_repr(PyBaseExceptionObject *self)
{ … }
static PyObject *
BaseException_reduce(PyBaseExceptionObject *self, PyObject *Py_UNUSED(ignored))
{ … }
static PyObject *
BaseException_setstate(PyObject *self, PyObject *state)
{ … }
static PyObject *
BaseException_with_traceback(PyObject *self, PyObject *tb) { … }
PyDoc_STRVAR(with_traceback_doc,
"Exception.with_traceback(tb) --\n\
set self.__traceback__ to tb and return self.");
static inline PyBaseExceptionObject*
_PyBaseExceptionObject_cast(PyObject *exc)
{ … }
static PyObject *
BaseException_add_note(PyObject *self, PyObject *note)
{ … }
PyDoc_STRVAR(add_note_doc,
"Exception.add_note(note) --\n\
add a note to the exception");
static PyMethodDef BaseException_methods[] = …;
static PyObject *
BaseException_get_args(PyBaseExceptionObject *self, void *Py_UNUSED(ignored))
{ … }
static int
BaseException_set_args(PyBaseExceptionObject *self, PyObject *val, void *Py_UNUSED(ignored))
{ … }
static PyObject *
BaseException_get_tb(PyBaseExceptionObject *self, void *Py_UNUSED(ignored))
{ … }
static int
BaseException_set_tb(PyBaseExceptionObject *self, PyObject *tb, void *Py_UNUSED(ignored))
{ … }
static PyObject *
BaseException_get_context(PyObject *self, void *Py_UNUSED(ignored))
{ … }
static int
BaseException_set_context(PyObject *self, PyObject *arg, void *Py_UNUSED(ignored))
{ … }
static PyObject *
BaseException_get_cause(PyObject *self, void *Py_UNUSED(ignored))
{ … }
static int
BaseException_set_cause(PyObject *self, PyObject *arg, void *Py_UNUSED(ignored))
{ … }
static PyGetSetDef BaseException_getset[] = …;
PyObject *
PyException_GetTraceback(PyObject *self)
{ … }
int
PyException_SetTraceback(PyObject *self, PyObject *tb)
{ … }
PyObject *
PyException_GetCause(PyObject *self)
{ … }
void
PyException_SetCause(PyObject *self, PyObject *cause)
{ … }
PyObject *
PyException_GetContext(PyObject *self)
{ … }
void
PyException_SetContext(PyObject *self, PyObject *context)
{ … }
PyObject *
PyException_GetArgs(PyObject *self)
{ … }
void
PyException_SetArgs(PyObject *self, PyObject *args)
{ … }
const char *
PyExceptionClass_Name(PyObject *ob)
{ … }
static struct PyMemberDef BaseException_members[] = …;
static PyTypeObject _PyExc_BaseException = …;
PyObject *PyExc_BaseException = …;
#define SimpleExtendsException(EXCBASE, EXCNAME, EXCDOC) …
#define MiddlingExtendsExceptionEx(EXCBASE, EXCNAME, PYEXCNAME, EXCSTORE, EXCDOC) …
#define MiddlingExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDOC) …
#define ComplexExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCNEW, \
EXCMETHODS, EXCMEMBERS, EXCGETSET, \
EXCSTR, EXCDOC) …
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
static PyMemberDef StopIteration_members[] = …;
static int
StopIteration_init(PyStopIterationObject *self, PyObject *args, PyObject *kwds)
{ … }
static int
StopIteration_clear(PyStopIterationObject *self)
{ … }
static void
StopIteration_dealloc(PyStopIterationObject *self)
{ … }
static int
StopIteration_traverse(PyStopIterationObject *self, visitproc visit, void *arg)
{ … }
ComplexExtendsException(…);
SimpleExtendsException(…);
static int
SystemExit_init(PySystemExitObject *self, PyObject *args, PyObject *kwds)
{ … }
static int
SystemExit_clear(PySystemExitObject *self)
{ … }
static void
SystemExit_dealloc(PySystemExitObject *self)
{ … }
static int
SystemExit_traverse(PySystemExitObject *self, visitproc visit, void *arg)
{ … }
static PyMemberDef SystemExit_members[] = …;
ComplexExtendsException(…);
static inline PyBaseExceptionGroupObject*
_PyBaseExceptionGroupObject_cast(PyObject *exc)
{ … }
static PyObject *
BaseExceptionGroup_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{ … }
PyObject *
_PyExc_CreateExceptionGroup(const char *msg_str, PyObject *excs)
{ … }
static int
BaseExceptionGroup_init(PyBaseExceptionGroupObject *self,
PyObject *args, PyObject *kwds)
{ … }
static int
BaseExceptionGroup_clear(PyBaseExceptionGroupObject *self)
{ … }
static void
BaseExceptionGroup_dealloc(PyBaseExceptionGroupObject *self)
{ … }
static int
BaseExceptionGroup_traverse(PyBaseExceptionGroupObject *self,
visitproc visit, void *arg)
{ … }
static PyObject *
BaseExceptionGroup_str(PyBaseExceptionGroupObject *self)
{ … }
static PyObject *
BaseExceptionGroup_derive(PyObject *self_, PyObject *excs)
{ … }
static int
exceptiongroup_subset(
PyBaseExceptionGroupObject *_orig, PyObject *excs, PyObject **result)
{ … }
_exceptiongroup_split_matcher_type;
static int
get_matcher_type(PyObject *value,
_exceptiongroup_split_matcher_type *type)
{ … }
static int
exceptiongroup_split_check_match(PyObject *exc,
_exceptiongroup_split_matcher_type matcher_type,
PyObject *matcher_value)
{ … }
_exceptiongroup_split_result;
static int
exceptiongroup_split_recursive(PyObject *exc,
_exceptiongroup_split_matcher_type matcher_type,
PyObject *matcher_value,
bool construct_rest,
_exceptiongroup_split_result *result)
{ … }
static PyObject *
BaseExceptionGroup_split(PyObject *self, PyObject *matcher_value)
{ … }
static PyObject *
BaseExceptionGroup_subgroup(PyObject *self, PyObject *matcher_value)
{ … }
static int
collect_exception_group_leaf_ids(PyObject *exc, PyObject *leaf_ids)
{ … }
static PyObject *
exception_group_projection(PyObject *eg, PyObject *keep)
{ … }
static bool
is_same_exception_metadata(PyObject *exc1, PyObject *exc2)
{ … }
PyObject *
_PyExc_PrepReraiseStar(PyObject *orig, PyObject *excs)
{ … }
PyObject *
PyUnstable_Exc_PrepReraiseStar(PyObject *orig, PyObject *excs)
{ … }
static PyMemberDef BaseExceptionGroup_members[] = …;
static PyMethodDef BaseExceptionGroup_methods[] = …;
ComplexExtendsException(…);
static PyObject*
create_exception_group_class(void) { … }
SimpleExtendsException(…);
static int
ImportError_init(PyImportErrorObject *self, PyObject *args, PyObject *kwds)
{ … }
static int
ImportError_clear(PyImportErrorObject *self)
{ … }
static void
ImportError_dealloc(PyImportErrorObject *self)
{ … }
static int
ImportError_traverse(PyImportErrorObject *self, visitproc visit, void *arg)
{ … }
static PyObject *
ImportError_str(PyImportErrorObject *self)
{ … }
static PyObject *
ImportError_getstate(PyImportErrorObject *self)
{ … }
static PyObject *
ImportError_reduce(PyImportErrorObject *self, PyObject *Py_UNUSED(ignored))
{ … }
static PyMemberDef ImportError_members[] = …;
static PyMethodDef ImportError_methods[] = …;
ComplexExtendsException(…);
MiddlingExtendsException(…);
#ifdef MS_WINDOWS
#include "errmap.h"
#endif
static int
oserror_parse_args(PyObject **p_args,
PyObject **myerrno, PyObject **strerror,
PyObject **filename, PyObject **filename2
#ifdef MS_WINDOWS
, PyObject **winerror
#endif
)
{ … }
static int
oserror_init(PyOSErrorObject *self, PyObject **p_args,
PyObject *myerrno, PyObject *strerror,
PyObject *filename, PyObject *filename2
#ifdef MS_WINDOWS
, PyObject *winerror
#endif
)
{ … }
static PyObject *
OSError_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
static int
OSError_init(PyOSErrorObject *self, PyObject *args, PyObject *kwds);
static int
oserror_use_init(PyTypeObject *type)
{ … }
static PyObject *
OSError_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{ … }
static int
OSError_init(PyOSErrorObject *self, PyObject *args, PyObject *kwds)
{ … }
static int
OSError_clear(PyOSErrorObject *self)
{ … }
static void
OSError_dealloc(PyOSErrorObject *self)
{ … }
static int
OSError_traverse(PyOSErrorObject *self, visitproc visit,
void *arg)
{ … }
static PyObject *
OSError_str(PyOSErrorObject *self)
{ … }
static PyObject *
OSError_reduce(PyOSErrorObject *self, PyObject *Py_UNUSED(ignored))
{ … }
static PyObject *
OSError_written_get(PyOSErrorObject *self, void *context)
{ … }
static int
OSError_written_set(PyOSErrorObject *self, PyObject *arg, void *context)
{ … }
static PyMemberDef OSError_members[] = …;
static PyMethodDef OSError_methods[] = …;
static PyGetSetDef OSError_getset[] = …;
ComplexExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
static int
NameError_init(PyNameErrorObject *self, PyObject *args, PyObject *kwds)
{ … }
static int
NameError_clear(PyNameErrorObject *self)
{ … }
static void
NameError_dealloc(PyNameErrorObject *self)
{ … }
static int
NameError_traverse(PyNameErrorObject *self, visitproc visit, void *arg)
{ … }
static PyMemberDef NameError_members[] = …;
static PyMethodDef NameError_methods[] = …;
ComplexExtendsException(…);
MiddlingExtendsException(…);
static int
AttributeError_init(PyAttributeErrorObject *self, PyObject *args, PyObject *kwds)
{ … }
static int
AttributeError_clear(PyAttributeErrorObject *self)
{ … }
static void
AttributeError_dealloc(PyAttributeErrorObject *self)
{ … }
static int
AttributeError_traverse(PyAttributeErrorObject *self, visitproc visit, void *arg)
{ … }
static PyObject *
AttributeError_getstate(PyAttributeErrorObject *self, PyObject *Py_UNUSED(ignored))
{ … }
static PyObject *
AttributeError_reduce(PyAttributeErrorObject *self, PyObject *Py_UNUSED(ignored))
{ … }
static PyMemberDef AttributeError_members[] = …;
static PyMethodDef AttributeError_methods[] = …;
ComplexExtendsException(…);
static int
SyntaxError_init(PySyntaxErrorObject *self, PyObject *args, PyObject *kwds)
{ … }
static int
SyntaxError_clear(PySyntaxErrorObject *self)
{ … }
static void
SyntaxError_dealloc(PySyntaxErrorObject *self)
{ … }
static int
SyntaxError_traverse(PySyntaxErrorObject *self, visitproc visit, void *arg)
{ … }
static PyObject*
my_basename(PyObject *name)
{ … }
static PyObject *
SyntaxError_str(PySyntaxErrorObject *self)
{ … }
static PyMemberDef SyntaxError_members[] = …;
ComplexExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsException(…);
MiddlingExtendsExceptionEx(PyExc_SyntaxError, IncompleteInputError, _IncompleteInputError,
SyntaxError, "incomplete input.");
SimpleExtendsException(…);
SimpleExtendsException(…);
static PyObject *
KeyError_str(PyBaseExceptionObject *self)
{ … }
ComplexExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
static PyObject *
get_string(PyObject *attr, const char *name)
{ … }
static PyObject *
get_unicode(PyObject *attr, const char *name)
{ … }
static int
set_unicodefromstring(PyObject **attr, const char *value)
{ … }
PyObject *
PyUnicodeEncodeError_GetEncoding(PyObject *exc)
{ … }
PyObject *
PyUnicodeDecodeError_GetEncoding(PyObject *exc)
{ … }
PyObject *
PyUnicodeEncodeError_GetObject(PyObject *exc)
{ … }
PyObject *
PyUnicodeDecodeError_GetObject(PyObject *exc)
{ … }
PyObject *
PyUnicodeTranslateError_GetObject(PyObject *exc)
{ … }
int
PyUnicodeEncodeError_GetStart(PyObject *exc, Py_ssize_t *start)
{ … }
int
PyUnicodeDecodeError_GetStart(PyObject *exc, Py_ssize_t *start)
{ … }
int
PyUnicodeTranslateError_GetStart(PyObject *exc, Py_ssize_t *start)
{ … }
int
PyUnicodeEncodeError_SetStart(PyObject *exc, Py_ssize_t start)
{ … }
int
PyUnicodeDecodeError_SetStart(PyObject *exc, Py_ssize_t start)
{ … }
int
PyUnicodeTranslateError_SetStart(PyObject *exc, Py_ssize_t start)
{ … }
int
PyUnicodeEncodeError_GetEnd(PyObject *exc, Py_ssize_t *end)
{ … }
int
PyUnicodeDecodeError_GetEnd(PyObject *exc, Py_ssize_t *end)
{ … }
int
PyUnicodeTranslateError_GetEnd(PyObject *exc, Py_ssize_t *end)
{ … }
int
PyUnicodeEncodeError_SetEnd(PyObject *exc, Py_ssize_t end)
{ … }
int
PyUnicodeDecodeError_SetEnd(PyObject *exc, Py_ssize_t end)
{ … }
int
PyUnicodeTranslateError_SetEnd(PyObject *exc, Py_ssize_t end)
{ … }
PyObject *
PyUnicodeEncodeError_GetReason(PyObject *exc)
{ … }
PyObject *
PyUnicodeDecodeError_GetReason(PyObject *exc)
{ … }
PyObject *
PyUnicodeTranslateError_GetReason(PyObject *exc)
{ … }
int
PyUnicodeEncodeError_SetReason(PyObject *exc, const char *reason)
{ … }
int
PyUnicodeDecodeError_SetReason(PyObject *exc, const char *reason)
{ … }
int
PyUnicodeTranslateError_SetReason(PyObject *exc, const char *reason)
{ … }
static int
UnicodeError_clear(PyUnicodeErrorObject *self)
{ … }
static void
UnicodeError_dealloc(PyUnicodeErrorObject *self)
{ … }
static int
UnicodeError_traverse(PyUnicodeErrorObject *self, visitproc visit, void *arg)
{ … }
static PyMemberDef UnicodeError_members[] = …;
static int
UnicodeEncodeError_init(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
UnicodeEncodeError_str(PyObject *self)
{ … }
static PyTypeObject _PyExc_UnicodeEncodeError = …;
PyObject *PyExc_UnicodeEncodeError = …;
static int
UnicodeDecodeError_init(PyObject *self, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
UnicodeDecodeError_str(PyObject *self)
{ … }
static PyTypeObject _PyExc_UnicodeDecodeError = …;
PyObject *PyExc_UnicodeDecodeError = …;
PyObject *
PyUnicodeDecodeError_Create(
const char *encoding, const char *object, Py_ssize_t length,
Py_ssize_t start, Py_ssize_t end, const char *reason)
{ … }
static int
UnicodeTranslateError_init(PyUnicodeErrorObject *self, PyObject *args,
PyObject *kwds)
{ … }
static PyObject *
UnicodeTranslateError_str(PyObject *self)
{ … }
static PyTypeObject _PyExc_UnicodeTranslateError = …;
PyObject *PyExc_UnicodeTranslateError = …;
PyObject *
_PyUnicodeTranslateError_Create(
PyObject *object,
Py_ssize_t start, Py_ssize_t end, const char *reason)
{ … }
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
#define MEMERRORS_SAVE …
static PyObject *
get_memory_error(int allow_allocation, PyObject *args, PyObject *kwds)
{ … }
static PyObject *
MemoryError_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{ … }
PyObject *
_PyErr_NoMemory(PyThreadState *tstate)
{ … }
static void
MemoryError_dealloc(PyObject *obj)
{ … }
static int
preallocate_memerrors(void)
{ … }
static void
free_preallocated_memerrors(struct _Py_exc_state *state)
{ … }
PyTypeObject _PyExc_MemoryError = …;
PyObject *PyExc_MemoryError = …;
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
SimpleExtendsException(…);
#ifdef MS_WINDOWS
#include <winsock2.h>
#undef EADDRINUSE
#undef EADDRNOTAVAIL
#undef EAFNOSUPPORT
#undef EALREADY
#undef ECONNABORTED
#undef ECONNREFUSED
#undef ECONNRESET
#undef EDESTADDRREQ
#undef EHOSTUNREACH
#undef EINPROGRESS
#undef EISCONN
#undef ELOOP
#undef EMSGSIZE
#undef ENETDOWN
#undef ENETRESET
#undef ENETUNREACH
#undef ENOBUFS
#undef ENOPROTOOPT
#undef ENOTCONN
#undef ENOTSOCK
#undef EOPNOTSUPP
#undef EPROTONOSUPPORT
#undef EPROTOTYPE
#undef EWOULDBLOCK
#if defined(WSAEALREADY) && !defined(EALREADY)
#define EALREADY …
#endif
#if defined(WSAECONNABORTED) && !defined(ECONNABORTED)
#define ECONNABORTED …
#endif
#if defined(WSAECONNREFUSED) && !defined(ECONNREFUSED)
#define ECONNREFUSED …
#endif
#if defined(WSAECONNRESET) && !defined(ECONNRESET)
#define ECONNRESET …
#endif
#if defined(WSAEINPROGRESS) && !defined(EINPROGRESS)
#define EINPROGRESS …
#endif
#if defined(WSAESHUTDOWN) && !defined(ESHUTDOWN)
#define ESHUTDOWN …
#endif
#if defined(WSAEWOULDBLOCK) && !defined(EWOULDBLOCK)
#define EWOULDBLOCK …
#endif
#endif
struct static_exception { … };
static struct static_exception static_exceptions[] = …;
int
_PyExc_InitTypes(PyInterpreterState *interp)
{ … }
static void
_PyExc_FiniTypes(PyInterpreterState *interp)
{ … }
PyStatus
_PyExc_InitGlobalObjects(PyInterpreterState *interp)
{ … }
PyStatus
_PyExc_InitState(PyInterpreterState *interp)
{ … }
int
_PyBuiltins_AddExceptions(PyObject *bltinmod)
{ … }
void
_PyExc_ClearExceptionGroupType(PyInterpreterState *interp)
{ … }
void
_PyExc_Fini(PyInterpreterState *interp)
{ … }
int
_PyException_AddNote(PyObject *exc, PyObject *note)
{ … }