summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>2021-10-22 23:13:46 (GMT)
committerGitHub <noreply@github.com>2021-10-22 23:13:46 (GMT)
commitf30ad65dbf3c6b1b5eec14dc954d65ef32327857 (patch)
tree410d8eb9335a1e405cbc7092e8f5a36e592ad712 /Include
parent4bc5473a42c5eae0928430930b897209492e849d (diff)
downloadcpython-f30ad65dbf3c6b1b5eec14dc954d65ef32327857.zip
cpython-f30ad65dbf3c6b1b5eec14dc954d65ef32327857.tar.gz
cpython-f30ad65dbf3c6b1b5eec14dc954d65ef32327857.tar.bz2
bpo-45292: [PEP 654] add the ExceptionGroup and BaseExceptionGroup classes (GH-28569)
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/pyerrors.h6
-rw-r--r--Include/internal/pycore_interp.h2
-rw-r--r--Include/internal/pycore_pylifecycle.h1
-rw-r--r--Include/pyerrors.h3
4 files changed, 12 insertions, 0 deletions
diff --git a/Include/cpython/pyerrors.h b/Include/cpython/pyerrors.h
index a3ec5af..28ab565 100644
--- a/Include/cpython/pyerrors.h
+++ b/Include/cpython/pyerrors.h
@@ -17,6 +17,12 @@ typedef struct {
typedef struct {
PyException_HEAD
PyObject *msg;
+ PyObject *excs;
+} PyBaseExceptionGroupObject;
+
+typedef struct {
+ PyException_HEAD
+ PyObject *msg;
PyObject *filename;
PyObject *lineno;
PyObject *offset;
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index 64ac3ab..c16f0a4 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -205,6 +205,8 @@ struct _Py_exc_state {
PyObject *errnomap;
PyBaseExceptionObject *memerrors_freelist;
int memerrors_numfree;
+ // The ExceptionGroup type
+ PyObject *PyExc_ExceptionGroup;
};
diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h
index 4f12fef..53b9474 100644
--- a/Include/internal/pycore_pylifecycle.h
+++ b/Include/internal/pycore_pylifecycle.h
@@ -93,6 +93,7 @@ extern void _PyAsyncGen_Fini(PyInterpreterState *interp);
extern int _PySignal_Init(int install_signal_handlers);
extern void _PySignal_Fini(void);
+extern void _PyExc_ClearExceptionGroupType(PyInterpreterState *interp);
extern void _PyExc_Fini(PyInterpreterState *interp);
extern void _PyImport_Fini(void);
extern void _PyImport_Fini2(void);
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index c6c443a..77d7914 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -60,11 +60,14 @@ PyAPI_FUNC(const char *) PyExceptionClass_Name(PyObject *);
#define PyExceptionInstance_Class(x) ((PyObject*)Py_TYPE(x))
+#define _PyBaseExceptionGroup_Check(x) \
+ PyObject_TypeCheck(x, (PyTypeObject *)PyExc_BaseExceptionGroup)
/* Predefined exceptions */
PyAPI_DATA(PyObject *) PyExc_BaseException;
PyAPI_DATA(PyObject *) PyExc_Exception;
+PyAPI_DATA(PyObject *) PyExc_BaseExceptionGroup;
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration;
#endif