Skip to content

Commit f23671c

Browse files
use PyType_GetSlot
1 parent a026273 commit f23671c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Modules/_struct.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,10 @@ static PyObject *
14511451
Struct_impl(PyTypeObject *type, PyObject *format)
14521452
/*[clinic end generated code: output=49468b044e334308 input=8b91868eb1df0e28]*/
14531453
{
1454-
PyStructObject *self = (PyStructObject *)type->tp_alloc(type, 0);
1454+
allocfunc alloc = PyType_GetSlot(type, Py_tp_alloc);
1455+
assert(alloc != NULL);
1456+
PyStructObject *self = (PyStructObject *)alloc(type, 0);
1457+
14551458
if (self == NULL) {
14561459
return NULL;
14571460
}

0 commit comments

Comments
 (0)