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