[Bf-blender-cvs] [0133bcaf38f] master: Fix crash starting Blender with Python 3.9
Campbell Barton
noreply at git.blender.org
Wed Oct 14 07:23:45 CEST 2020
Commit: 0133bcaf38f6ecb5d6937c9b762026cc452720de
Author: Campbell Barton
Date: Wed Oct 14 16:15:44 2020 +1100
Branches: master
https://developer.blender.org/rB0133bcaf38f6ecb5d6937c9b762026cc452720de
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.
===================================================================
M source/blender/python/intern/bpy_rna.c
===================================================================
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 7796d0a01a1..ce66cd6ee27 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -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);
}
}
More information about the Bf-blender-cvs
mailing list