FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

added exception groups by iritkatriel · Pull Request #25430 · python/cpython · GitHub

/ cpython Public
2 changes: 2 additions & 0 deletions Doc/data/stable_abi.dat
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff 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

Back | FazBrowse Home | New Git URL