diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-14 08:15:44 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-14 08:15:44 +0300 |
commit | 0133bcaf38f6ecb5d6937c9b762026cc452720de (patch) | |
tree | 67ae2417b88636ddc1943274292261b949022c8c /source/blender | |
parent | cb40edf63ae40d5010304c7770afd0d78ef709e7 (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 9 |
1 files changed, 6 insertions, 3 deletions
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); } } |