https://github.com/python/cpython/commit/7928a8b730b0334c9f97c2144ab00fe0d88f1e97
commit: 7928a8b730b0334c9f97c2144ab00fe0d88f1e97
branch: main
author: Ivy Xu <[email protected]>
committer: StanFromIreland <[email protected]>
date: 2026-06-23T15:48:11+01:00
summary:

gh-151126: Add missing `PyErr_NoMemory()` in `type_from_slots_or_spec` (#151582)

Co-authored-by: Stan Ulbrych <[email protected]>

files:
M Misc/ACKS
M Objects/typeobject.c

diff --git a/Misc/ACKS b/Misc/ACKS
index ee68d91f13c431..1f2049da56c2da 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -2145,6 +2145,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 59593fd0f6a0b7..777cf842fb9602 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -5493,6 +5493,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);
@@ -5779,7 +5780,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]

Reply via email to