https://github.com/python/cpython/commit/a6018c587e4e8c154581b70d43149606ffce4783 commit: a6018c587e4e8c154581b70d43149606ffce4783 branch: main author: Thomas Kowalski <[email protected]> committer: cmaloney <[email protected]> date: 2026-11-12T10:54:57-08:00 summary:
gh-151126: set `MemoryError` on alloc failure in `_PyXIData_InitWithSize` (#156301) Co-authored-by: Cody Maloney <[email protected]> files: A Misc/NEWS.d/next/Core_and_Builtins/2026-08-23-16-31-00.gh-issue-151126.phAWIG.rst M Python/crossinterp.c diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-08-23-16-31-00.gh-issue-151126.phAWIG.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-08-23-16-31-00.gh-issue-151126.phAWIG.rst new file mode 100644 index 00000000000000..b1459de1c1596d --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-08-23-16-31-00.gh-issue-151126.phAWIG.rst @@ -0,0 +1 @@ +Fix a crash when allocation failure occurs during :ref:`interp-object-sharing`. diff --git a/Python/crossinterp.c b/Python/crossinterp.c index b8dd5f11c2a44c..d189d7bcefe313 100644 --- a/Python/crossinterp.c +++ b/Python/crossinterp.c @@ -388,6 +388,8 @@ _PyXIData_InitWithSize(_PyXIData_t *xidata, _PyXIData_Init(xidata, interp, NULL, obj, new_object); xidata->data = PyMem_RawCalloc(1, size); if (xidata->data == NULL) { + Py_CLEAR(xidata->obj); + PyErr_NoMemory(); return -1; } xidata->free = PyMem_RawFree; _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
