cpython/Objects/exceptions.c

/*
 * New exceptions.c written in Iceland by Richard Jones and Georg Brandl.
 *
 * Thanks go to Tim Peters and Michael Hudson for debugging.
 */

#include <Python.h>
#include <stdbool.h>
#include "pycore_abstract.h"      // _PyObject_RealIsSubclass()
#include "pycore_ceval.h"         // _Py_EnterRecursiveCall
#include "pycore_exceptions.h"    // struct _Py_exc_state
#include "pycore_initconfig.h"
#include "pycore_modsupport.h"    // _PyArg_NoKeywords()
#include "pycore_object.h"
#include "pycore_pyerrors.h"      // struct _PyErr_SetRaisedException

#include "osdefs.h"               // SEP


/* Compatibility aliases */
PyObject *PyExc_EnvironmentError =;  // borrowed ref
PyObject *PyExc_IOError =;  // borrowed ref
#ifdef MS_WINDOWS
PyObject *PyExc_WindowsError = NULL;  // borrowed ref
#endif


static struct _Py_exc_state*
get_exc_state(void)
{}


/* NOTE: If the exception class hierarchy changes, don't forget to update
 * Lib/test/exception_hierarchy.txt
 */

/*
 *    BaseException
 */
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)
{}

/* Pickling support */
static PyObject *
BaseException_reduce(PyBaseExceptionObject *self, PyObject *Py_UNUSED(ignored))
{}

/*
 * Needed for backward compatibility, since exceptions used to store
 * all their attributes in the __dict__. Code is taken from cPickle's
 * load_build function.
 */
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)
{}

/* Steals a reference to cause */
void
PyException_SetCause(PyObject *self, PyObject *cause)
{}

PyObject *
PyException_GetContext(PyObject *self)
{}

/* Steals a reference to context */
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 =;
/* the CPython API expects exceptions to be (PyObject *) - both a hold-over
from the previous implementation and also allowing Python objects to be used
in the API */
PyObject *PyExc_BaseException =;

/* note these macros omit the last semicolon so the macro invocation may
 * include it and not look strange.
 */
#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)


/*
 *    Exception extends BaseException
 */
SimpleExtendsException();


/*
 *    TypeError extends Exception
 */
SimpleExtendsException();


/*
 *    StopAsyncIteration extends Exception
 */
SimpleExtendsException();


/*
 *    StopIteration extends Exception
 */

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();


/*
 *    GeneratorExit extends BaseException
 */
SimpleExtendsException();


/*
 *    SystemExit extends BaseException
 */

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();

/*
 *    BaseExceptionGroup extends BaseException
 *    ExceptionGroup extends BaseExceptionGroup and Exception
 */


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)
{}

/* This function is used by the interpreter to construct reraised
 * exception groups. It takes an exception group eg and a list
 * of exception groups keep and returns the sub-exception group
 * of eg which contains all leaf exceptions that are contained
 * in any exception group in keep.
 */
static PyObject *
exception_group_projection(PyObject *eg, PyObject *keep)
{}

static bool
is_same_exception_metadata(PyObject *exc1, PyObject *exc2)
{}

/*
   This function is used by the interpreter to calculate
   the exception group to be raised at the end of a
   try-except* construct.

   orig: the original except that was caught.
   excs: a list of exceptions that were raised/reraised
         in the except* clauses.

   Calculates an exception group to raise. It contains
   all exceptions in excs, where those that were reraised
   have same nesting structure as in orig, and those that
   were raised (if any) are added as siblings in a new EG.

   Returns NULL and sets an exception on failure.
*/
PyObject *
_PyExc_PrepReraiseStar(PyObject *orig, PyObject *excs)
{}

PyObject *
PyUnstable_Exc_PrepReraiseStar(PyObject *orig, PyObject *excs)
{}

static PyMemberDef BaseExceptionGroup_members[] =;

static PyMethodDef BaseExceptionGroup_methods[] =;

ComplexExtendsException();

/*
 *    ExceptionGroup extends BaseExceptionGroup, Exception
 */
static PyObject*
create_exception_group_class(void) {}

/*
 *    KeyboardInterrupt extends BaseException
 */
SimpleExtendsException();


/*
 *    ImportError extends Exception
 */

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)
{}

/* Pickling support */
static PyObject *
ImportError_reduce(PyImportErrorObject *self, PyObject *Py_UNUSED(ignored))
{}

static PyMemberDef ImportError_members[] =;

static PyMethodDef ImportError_methods[] =;

ComplexExtendsException();

/*
 *    ModuleNotFoundError extends ImportError
 */

MiddlingExtendsException();

/*
 *    OSError extends Exception
 */

#ifdef MS_WINDOWS
#include "errmap.h"
#endif

/* Where a function has a single filename, such as open() or some
 * of the os module functions, PyErr_SetFromErrnoWithFilename() is
 * called, giving a third argument which is the filename.  But, so
 * that old code using in-place unpacking doesn't break, e.g.:
 *
 * except OSError, (errno, strerror):
 *
 * we hack args so that it only contains two items.  This also
 * means we need our own __str__() which prints out the filename
 * when it was supplied.
 *
 * (If a function has two filenames, such as rename(), symlink(),
 * or copy(), PyErr_SetFromErrnoWithFilenameObjects() is called,
 * which allows passing in a second filename.)
 */

/* This function doesn't cleanup on error, the caller should */
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();


/*
 *    Various OSError subclasses
 */
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();
MiddlingExtendsException();

/*
 *    EOFError extends Exception
 */
SimpleExtendsException();


/*
 *    RuntimeError extends Exception
 */
SimpleExtendsException();

/*
 *    RecursionError extends RuntimeError
 */
SimpleExtendsException();

// PythonFinalizationError extends RuntimeError
SimpleExtendsException();

/*
 *    NotImplementedError extends RuntimeError
 */
SimpleExtendsException();

/*
 *    NameError extends Exception
 */

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();

/*
 *    UnboundLocalError extends NameError
 */

MiddlingExtendsException();

/*
 *    AttributeError extends Exception
 */

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)
{}

/* Pickling support */
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();

/*
 *    SyntaxError extends Exception
 */

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)
{}

/* This is called "my_basename" instead of just "basename" to avoid name
   conflicts with glibc; basename is already prototyped if _GNU_SOURCE is
   defined, and Python does define that. */
static PyObject*
my_basename(PyObject *name)
{}


static PyObject *
SyntaxError_str(PySyntaxErrorObject *self)
{}

static PyMemberDef SyntaxError_members[] =;

ComplexExtendsException();


/*
 *    IndentationError extends SyntaxError
 */
MiddlingExtendsException();


/*
 *    TabError extends IndentationError
 */
MiddlingExtendsException();

/*
 *    IncompleteInputError extends SyntaxError
 */
MiddlingExtendsExceptionEx(PyExc_SyntaxError, IncompleteInputError, _IncompleteInputError,
                           SyntaxError, "incomplete input.");

/*
 *    LookupError extends Exception
 */
SimpleExtendsException();


/*
 *    IndexError extends LookupError
 */
SimpleExtendsException();


/*
 *    KeyError extends LookupError
 */
static PyObject *
KeyError_str(PyBaseExceptionObject *self)
{}

ComplexExtendsException();


/*
 *    ValueError extends Exception
 */
SimpleExtendsException();

/*
 *    UnicodeError extends ValueError
 */

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[] =;


/*
 *    UnicodeEncodeError extends UnicodeError
 */

static int
UnicodeEncodeError_init(PyObject *self, PyObject *args, PyObject *kwds)
{}

static PyObject *
UnicodeEncodeError_str(PyObject *self)
{}

static PyTypeObject _PyExc_UnicodeEncodeError =;
PyObject *PyExc_UnicodeEncodeError =;


/*
 *    UnicodeDecodeError extends UnicodeError
 */

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)
{}


/*
 *    UnicodeTranslateError extends UnicodeError
 */

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)
{}

/*
 *    AssertionError extends Exception
 */
SimpleExtendsException();


/*
 *    ArithmeticError extends Exception
 */
SimpleExtendsException();


/*
 *    FloatingPointError extends ArithmeticError
 */
SimpleExtendsException();


/*
 *    OverflowError extends ArithmeticError
 */
SimpleExtendsException();


/*
 *    ZeroDivisionError extends ArithmeticError
 */
SimpleExtendsException();


/*
 *    SystemError extends Exception
 */
SimpleExtendsException();


/*
 *    ReferenceError extends Exception
 */
SimpleExtendsException();


/*
 *    MemoryError extends Exception
 */

#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 =;


/*
 *    BufferError extends Exception
 */
SimpleExtendsException();


/* Warning category docstrings */

/*
 *    Warning extends Exception
 */
SimpleExtendsException();


/*
 *    UserWarning extends Warning
 */
SimpleExtendsException();


/*
 *    DeprecationWarning extends Warning
 */
SimpleExtendsException();


/*
 *    PendingDeprecationWarning extends Warning
 */
SimpleExtendsException();


/*
 *    SyntaxWarning extends Warning
 */
SimpleExtendsException();


/*
 *    RuntimeWarning extends Warning
 */
SimpleExtendsException();


/*
 *    FutureWarning extends Warning
 */
SimpleExtendsException();


/*
 *    ImportWarning extends Warning
 */
SimpleExtendsException();


/*
 *    UnicodeWarning extends Warning
 */
SimpleExtendsException();


/*
 *    BytesWarning extends Warning
 */
SimpleExtendsException();


/*
 *    EncodingWarning extends Warning
 */
SimpleExtendsException();


/*
 *    ResourceWarning extends Warning
 */
SimpleExtendsException();



#ifdef MS_WINDOWS
#include <winsock2.h>
/* The following constants were added to errno.h in VS2010 but have
   preferred WSA equivalents. */
#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 /* MS_WINDOWS */

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)
{}


/* Add exception types to the builtins module */
int
_PyBuiltins_AddExceptions(PyObject *bltinmod)
{}

void
_PyExc_ClearExceptionGroupType(PyInterpreterState *interp)
{}

void
_PyExc_Fini(PyInterpreterState *interp)
{}

int
_PyException_AddNote(PyObject *exc, PyObject *note)
{}