Skip to content

Commit 7928a8b

Browse files
gh-151126: Add missing PyErr_NoMemory() in type_from_slots_or_spec (#151582)
Co-authored-by: Stan Ulbrych <stan@python.org>
1 parent d35b171 commit 7928a8b

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,6 +2145,7 @@ Xiang Zhang
21452145
Robert Xiao
21462146
Florent Xicluna
21472147
Yanbo, Xie
2148+
Ivy Xu
21482149
Kaisheng Xu
21492150
Xinhang Xu
21502151
Arnon Yaari

Objects/typeobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5493,6 +5493,7 @@ type_from_slots_or_spec(
54935493
Py_ssize_t name_buf_len = strlen(it.name) + 1;
54945494
_ht_tpname = PyMem_Malloc(name_buf_len);
54955495
if (_ht_tpname == NULL) {
5496+
PyErr_NoMemory();
54965497
goto finally;
54975498
}
54985499
memcpy(_ht_tpname, it.name, name_buf_len);
@@ -5779,7 +5780,7 @@ type_from_slots_or_spec(
57795780
((PyObject*)type)->ob_flags |= _Py_TYPE_REVEALED_FLAG;
57805781
#endif
57815782

5782-
finally:
5783+
finally:
57835784
if (PyErr_Occurred()) {
57845785
Py_CLEAR(res);
57855786
}

0 commit comments

Comments
 (0)