https://github.com/python/cpython/commit/2ff445be4ea6a74b105606118ed50ab4505ee6a1 commit: 2ff445be4ea6a74b105606118ed50ab4505ee6a1 branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: StanFromIreland <[email protected]> date: 2026-06-23T15:15:00Z summary:
[3.15] gh-151126: Add missing `PyErr_NoMemory()` in `type_from_slots_or_spec` (GH-151582) (#152016) (cherry picked from commit 7928a8b730b0334c9f97c2144ab00fe0d88f1e97) Co-authored-by: Ivy Xu <[email protected]> Co-authored-by: Stan Ulbrych <[email protected]> files: M Misc/ACKS M Objects/typeobject.c diff --git a/Misc/ACKS b/Misc/ACKS index 38817b1698c09a..5b5df7ae11f2df 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -2144,6 +2144,7 @@ Xiang Zhang Robert Xiao Florent Xicluna Yanbo, Xie +Ivy Xu Kaisheng Xu Xinhang Xu Arnon Yaari diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 12821b134d9709..969ae450013a31 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -5488,6 +5488,7 @@ type_from_slots_or_spec( Py_ssize_t name_buf_len = strlen(it.name) + 1; _ht_tpname = PyMem_Malloc(name_buf_len); if (_ht_tpname == NULL) { + PyErr_NoMemory(); goto finally; } memcpy(_ht_tpname, it.name, name_buf_len); @@ -5774,7 +5775,7 @@ type_from_slots_or_spec( ((PyObject*)type)->ob_flags |= _Py_TYPE_REVEALED_FLAG; #endif - finally: +finally: if (PyErr_Occurred()) { Py_CLEAR(res); } _______________________________________________ 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]
