Skip to content

Commit 1f4e927

Browse files
committed
Py_TYPE() has already dereferenced self before the NULL check. Moved Py_TYPE() after the check for self == NULL
1 parent 7a6bbeb commit 1f4e927

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Objects/classobject.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,15 @@ method_repr(PyMethodObject *a)
218218
{
219219
PyObject *self = a->im_self;
220220
PyObject *func = a->im_func;
221-
PyObject *klass = (PyObject*)Py_TYPE(self);
221+
PyObject *klass;
222222
PyObject *funcname = NULL ,*klassname = NULL, *result = NULL;
223223
char *defname = "?";
224224

225225
if (self == NULL) {
226226
PyErr_BadInternalCall();
227227
return NULL;
228228
}
229+
klass = (PyObject*)Py_TYPE(self);
229230

230231
funcname = PyObject_GetAttrString(func, "__name__");
231232
if (funcname == NULL) {

0 commit comments

Comments
 (0)