Skip to content
This repository was archived by the owner on Jan 18, 2024. It is now read-only.

Commit f03572d

Browse files
committed
Py_TYPE() has already dereferenced self before the NULL check. Moved Py_TYPE() after the check for self == NULL
2 parents 1b5c76a + 949f331 commit f03572d

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
@@ -219,14 +219,15 @@ method_repr(PyMethodObject *a)
219219
{
220220
PyObject *self = a->im_self;
221221
PyObject *func = a->im_func;
222-
PyObject *klass = (PyObject*)Py_TYPE(self);
222+
PyObject *klass;
223223
PyObject *funcname = NULL ,*klassname = NULL, *result = NULL;
224224
char *defname = "?";
225225

226226
if (self == NULL) {
227227
PyErr_BadInternalCall();
228228
return NULL;
229229
}
230+
klass = (PyObject*)Py_TYPE(self);
230231

231232
funcname = _PyObject_GetAttrId(func, &PyId___name__);
232233
if (funcname == NULL) {

0 commit comments

Comments
 (0)