mirror of
https://github.com/python/cpython.git
synced 2026-10-28 10:25:05 +08:00
[3.14] gh-159294: Fix crash when creating an ExceptionGroup fails with MemoryError (GH-159295) (#160505)
Co-authored-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com> Co-authored-by: Stan Ulbrych <stan@python.org>
This commit is contained in:
2 files changed
+6
-3
No files matched your search
@@ -0,0 +1,3 @@
|
||||
Fix a crash in a debug build when creating an :exc:`ExceptionGroup` or
|
||||
:exc:`BaseExceptionGroup` fails with :exc:`MemoryError`. Patch by Christian
|
||||
Aurich Zanettini Martins.
|
||||
@@ -998,11 +998,11 @@ BaseExceptionGroup_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
*/
|
||||
cls = (PyTypeObject*)PyExc_BaseExceptionGroup;
|
||||
}
|
||||
PyBaseExceptionGroupObject *self =
|
||||
PyBaseExceptionGroupObject_CAST(BaseException_new(cls, args, kwds));
|
||||
if (!self) {
|
||||
PyObject *op = BaseException_new(cls, args, kwds);
|
||||
if (!op) {
|
||||
goto error;
|
||||
}
|
||||
PyBaseExceptionGroupObject *self = PyBaseExceptionGroupObject_CAST(op);
|
||||
|
||||
self->msg = Py_NewRef(message);
|
||||
self->excs = exceptions;
|
||||
|
||||
Reference in new issue
Block a user