Skip to content

Commit 54dc884

Browse files
committed
Simplify CPy_SetupObject
1 parent 499389f commit 54dc884

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

mypyc/lib-rt/generic_ops.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,10 @@ PyObject *CPy_SetupObject(PyObject *type) {
7575
}
7676

7777
if (!strcmp(def->ml_name, "__internal_mypyc_setup")) {
78-
break;
78+
return ((SetupFunction)(void(*)(void))def->ml_meth)(type);
7979
}
8080
}
81-
if (!def || !def->ml_name) {
82-
PyErr_SetString(PyExc_RuntimeError, "Internal mypyc error: Unable to find object setup function");
83-
return NULL;
84-
}
8581

86-
return ((SetupFunction)(void(*)(void))def->ml_meth)(type);
82+
PyErr_SetString(PyExc_RuntimeError, "Internal mypyc error: Unable to find object setup function");
83+
return NULL;
8784
}

0 commit comments

Comments
 (0)