From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 23 Jun 2026 15:12:29 +0000 (+0200) Subject: [3.13] gh-151126: Add missing `PyErr_NoMemory()` in `type_from_slots_or_spec` (GH... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abf5016b4dd43dbab84b0be4e85446e645f8c1e1;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-151126: Add missing `PyErr_NoMemory()` in `type_from_slots_or_spec` (GH-151582) (cherry picked from commit 7928a8b730b0334c9f97c2144ab00fe0d88f1e97) Co-authored-by: Ivy Xu Co-authored-by: Stan Ulbrych --- diff --git a/Misc/ACKS b/Misc/ACKS index c1216b21e373..29fc185ab3b4 100644 --- a/Misc/ACKS +++ b/Misc/ACKS @@ -2079,6 +2079,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 8f44c99f6a76..bbdfbfc03c98 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -4581,6 +4581,7 @@ _PyType_FromMetaclass_impl( Py_ssize_t name_buf_len = strlen(spec->name) + 1; _ht_tpname = PyMem_Malloc(name_buf_len); if (_ht_tpname == NULL) { + PyErr_NoMemory(); goto finally; } memcpy(_ht_tpname, spec->name, name_buf_len); @@ -4862,7 +4863,7 @@ _PyType_FromMetaclass_impl( assert(_PyType_CheckConsistency(type)); - finally: +finally: if (PyErr_Occurred()) { Py_CLEAR(res); }