Fix crash starting Blender with Python 3.9

In 3.8 and older the class held a reference to methods,
this is no longer the case in 3.9.
This commit is contained in:
Campbell Barton 2020-10-14 16:15:44 +11:00
parent cb40edf63a
commit 0133bcaf38
1 changed files with 6 additions and 3 deletions

View File

@ -8131,9 +8131,8 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr,
PyErr_Clear();
}
else {
/* No need to keep a ref, the class owns it
* (technically we should keep a reference, but...). */
Py_DECREF(item);
/* Store original so we can decrement it's reference before returning. */
PyObject *item_orig = item;
if (is_staticmethod) {
if (PyMethod_Check(item) == 0) {
@ -8144,6 +8143,7 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr,
py_class_name,
RNA_function_identifier(func),
Py_TYPE(item)->tp_name);
Py_DECREF(item_orig);
return -1;
}
item = ((PyMethodObject *)item)->im_func;
@ -8157,6 +8157,7 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr,
py_class_name,
RNA_function_identifier(func),
Py_TYPE(item)->tp_name);
Py_DECREF(item_orig);
return -1;
}
}
@ -8197,9 +8198,11 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr,
func_arg_count,
arg_count);
}
Py_DECREF(item_orig);
return -1;
}
}
Py_DECREF(item_orig);
}
}