]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-151126: Add missing `PyErr_NoMemory()` in `type_from_slots_or_spec` (#151582)
authorIvy Xu <fakeshadow1337@gmail.com>
Tue, 23 Jun 2026 14:48:11 +0000 (22:48 +0800)
committerGitHub <noreply@github.com>
Tue, 23 Jun 2026 14:48:11 +0000 (15:48 +0100)
Co-authored-by: Stan Ulbrych <stan@python.org>
Misc/ACKS
Objects/typeobject.c

index ee68d91f13c431f7ed69360625db1c1b4ecd008f..1f2049da56c2da7f2412b8ad0516a91a7265b832 100644 (file)
--- 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
index 59593fd0f6a0b78331250222437f2e021ff6cd0b..777cf842fb9602cf7a432802e773d5185f6f9f39 100644 (file)
@@ -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);
     }