Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-03-16 04:18:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-03-16 07:17:45 +0300
commite125305af41a7360c52b9a38024b7e24fde06d70 (patch)
tree89670ef582473388c7c87fe42f4ae81f0a44132d /source/blender/makesrna/RNA_define.h
parentbe51d671b500e8b6881295778de7272a70504b71 (diff)
Fix T86332: Error using lambda in annotations in Python 3.10
Callbacks used in `bpy.props` didn't hold a references to the functions they used. While this has been the case since early 2.5x it didn't cause any problems as long as the class held a reference. With Python 3.10 or when using `from __future__ import annotations`, the annotations are no longer owned by the class once evaluated. Resolve this by holding a reference in the module, which now supports traverse & clear callbacks so the objects are visible to Python's garbage collector. Also refactor storage of Python data, moving from an array into a struct.
Diffstat (limited to 'source/blender/makesrna/RNA_define.h')
-rw-r--r--source/blender/makesrna/RNA_define.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index c49a52ceed7..bc1a8f52b8d 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -465,8 +465,6 @@ void RNA_def_property_string_funcs_runtime(PropertyRNA *prop,
StringPropertyLengthFunc lengthfunc,
StringPropertySetFunc setfunc);
-void RNA_def_property_enum_py_data(PropertyRNA *prop, void *py_data);
-
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context);
/* Function */
@@ -507,6 +505,9 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA
void RNA_def_property_free_pointers(PropertyRNA *prop);
int RNA_def_property_free_identifier(StructOrFunctionRNA *cont_, const char *identifier);
+void RNA_def_property_free_pointers_set_py_data_callback(
+ void (*py_data_clear_fn)(PropertyRNA *prop));
+
/* utilities */
const char *RNA_property_typename(PropertyType type);
#define IS_DNATYPE_FLOAT_COMPAT(_str) (strcmp(_str, "float") == 0 || strcmp(_str, "double") == 0)