diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-02-20 08:16:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-02-20 08:19:33 +0300 |
commit | 37e6a1995ac7eeabd5b6a56621ad5a850dae4149 (patch) | |
tree | 5a3531d6e7a033c7afe81f97ac3dc157c79cb00a /source/blender/python/intern/bpy_props.h | |
parent | 4cd808f912173b8c59c217860313e178102e893e (diff) |
PyAPI: use a new type for storing the deferred result of bpy.props
This is needed to support Python 3.10's Postponed annotation evaluation.
It also simplifies type checking.
Diffstat (limited to 'source/blender/python/intern/bpy_props.h')
-rw-r--r-- | source/blender/python/intern/bpy_props.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_props.h b/source/blender/python/intern/bpy_props.h index 3d7860dcdd8..6cebf82d373 100644 --- a/source/blender/python/intern/bpy_props.h +++ b/source/blender/python/intern/bpy_props.h @@ -30,6 +30,16 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw); PyObject *BPy_CollectionProperty(PyObject *self, PyObject *args, PyObject *kw); StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix); +typedef struct { + PyObject_HEAD + /* This isn't GC tracked, it's a function from `bpy.props` so it's not going away. */ + void *fn; + PyObject *kw; +} BPy_PropDeferred; + +extern PyTypeObject bpy_prop_deferred_Type; +#define BPy_PropDeferred_CheckTypeExact(v) (Py_TYPE(v) == &bpy_prop_deferred_Type) + #define PYRNA_STACK_ARRAY RNA_STACK_ARRAY #ifdef __cplusplus |