Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-151126: Add missing PyErr_NoMemory() in type_from_slots_or_spec (
GH-151582)

(cherry picked from commit 7928a8b)

Co-authored-by: Ivy Xu <fakeshadow1337@gmail.com>
Co-authored-by: Stan Ulbrych <stan@python.org>
  • Loading branch information
2 people authored and miss-islington committed Jun 23, 2026
commit 21df62a26193af5f09bf74cab552b9e128d056a9
1 change: 1 addition & 0 deletions Misc/ACKS
Original file line number Diff line number Diff line change
Expand Up @@ -2079,6 +2079,7 @@ Xiang Zhang
Robert Xiao
Florent Xicluna
Yanbo, Xie
Ivy Xu
Kaisheng Xu
Xinhang Xu
Arnon Yaari
Expand Down
3 changes: 2 additions & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -4862,7 +4863,7 @@ _PyType_FromMetaclass_impl(

assert(_PyType_CheckConsistency(type));

finally:
finally:
if (PyErr_Occurred()) {
Py_CLEAR(res);
}
Expand Down
Loading