Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Doc/data/stable_abi.dat
Original file line numberDiff line numberDiff line change
Expand Up@@ -189,6 +189,7 @@ var,PyExc_ArithmeticError,3.2,
var,PyExc_AssertionError,3.2,
var,PyExc_AttributeError,3.2,
var,PyExc_BaseException,3.2,
var,PyExc_BaseExceptionGroup,3.11,
var,PyExc_BlockingIOError,3.7,
var,PyExc_BrokenPipeError,3.7,
var,PyExc_BufferError,3.2,
Expand All@@ -203,6 +204,7 @@ var,PyExc_EOFError,3.2,
var,PyExc_EncodingWarning,3.10,
var,PyExc_EnvironmentError,3.2,
var,PyExc_Exception,3.2,
var,PyExc_ExceptionGroup,3.11,
var,PyExc_FileExistsError,3.7,
var,PyExc_FileNotFoundError,3.7,
var,PyExc_FloatingPointError,3.2,
Expand Down
6 changes: 6 additions & 0 deletions Include/cpython/pyerrors.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -14,6 +14,12 @@ typedef struct {
PyException_HEAD
} PyBaseExceptionObject;

typedef struct {
PyException_HEAD
PyObject *msg;
PyObject *excs;
} PyBaseExceptionGroupObject;

typedef struct {
PyException_HEAD
PyObject *msg;
Expand Down
2 changes: 2 additions & 0 deletions Include/pyerrors.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -65,6 +65,8 @@ PyAPI_FUNC(const char *) PyExceptionClass_Name(PyObject *);

PyAPI_DATA(PyObject *) PyExc_BaseException;
PyAPI_DATA(PyObject *) PyExc_Exception;
PyAPI_DATA(PyObject *) PyExc_BaseExceptionGroup;
PyAPI_DATA(PyObject *) PyExc_ExceptionGroup;
Comment thread
iritkatriel marked this conversation as resolved.
Outdated
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03050000
PyAPI_DATA(PyObject *) PyExc_StopAsyncIteration;
#endif
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/exception_hierarchy.txt
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,9 @@ BaseException
+-- SystemExit
+-- KeyboardInterrupt
+-- GeneratorExit
+-- BaseExceptionGroup
+-- Exception
+-- ExceptionGroup [BaseExceptionGroup]
+-- StopIteration
+-- StopAsyncIteration
+-- ArithmeticError
Expand Down
6 changes: 5 additions & 1 deletion Lib/test/test_descr.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -4026,7 +4026,11 @@ def test_builtin_bases(self):
for tp in builtin_types:
object.__getattribute__(tp, "__bases__")
if tp is not object:
self.assertEqual(len(tp.__bases__), 1, tp)
if tp is ExceptionGroup:
num_bases = 2
else:
num_bases = 1
self.assertEqual(len(tp.__bases__), num_bases, tp)

class L(list):
pass
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_doctest.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -668,7 +668,7 @@ def non_Python_modules(): r"""

>>> import builtins
>>> tests = doctest.DocTestFinder().find(builtins)
>>> 816 < len(tests) < 836 # approximate number of objects with docstrings
>>> 816 < len(tests) < 840 # approximate number of objects with docstrings
True
>>> real_tests = [t for t in tests if len(t.examples) > 0]
>>> len(real_tests) # objects that actually have doctests
Expand Down
Loading