diff options
Diffstat (limited to 'source/blender/python/intern/bpy_rna.c')
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index ecaa5791e38..7a43c9cb997 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -2061,6 +2061,19 @@ static int pyrna_py_to_prop( Py_XDECREF(value_new); return -1; } + + if (value_owner_id->tag & LIB_TAG_TEMP_MAIN) { + /* Allow passing temporary ID's to functions, but not attribute assignment. */ + if (ptr->type != &RNA_Function) { + PyErr_Format(PyExc_TypeError, + "%.200s %.200s.%.200s ID type assignment is temporary, can't assign", + error_prefix, + RNA_struct_identifier(ptr->type), + RNA_property_identifier(prop)); + Py_XDECREF(value_new); + return -1; + } + } } } |