Skip to content

Commit 4621839

Browse files
Fix missing PyErr_NoMemory in typeobject.c
1 parent 9e863fa commit 4621839

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Avoid possible crash in ``typeobject.c`` where a device has no memory left.
2+
Now it properly raises a :exc:`MemoryError`. Patch by Ivy Xu.

Objects/typeobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5492,6 +5492,7 @@ type_from_slots_or_spec(
54925492
Py_ssize_t name_buf_len = strlen(it.name) + 1;
54935493
_ht_tpname = PyMem_Malloc(name_buf_len);
54945494
if (_ht_tpname == NULL) {
5495+
PyErr_NoMemory();
54955496
goto finally;
54965497
}
54975498
memcpy(_ht_tpname, it.name, name_buf_len);

0 commit comments

Comments
 (0)