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>2018-08-28 06:50:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-08-28 06:55:11 +0300
commit039b11f3497731572e36904b03550438b706df34 (patch)
tree27a266c426a9ca54a1f8a6b4cc32fe9145ea84d5 /source/blender/python/intern/bpy_rna.c
parent5bf42ce022048b4945d5bdd69fe3dbd9bbccfb92 (diff)
PyRNA: all optional args now must be keyword args
In some cases the RNA API should be updated to make arguments use the 'required' flag, instead of adjusting Python scripts. See T47811
Diffstat (limited to 'source/blender/python/intern/bpy_rna.c')
-rw-r--r--source/blender/python/intern/bpy_rna.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 30bd3bc5ca3..9de9f6179d6 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -5654,6 +5654,17 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject
item = NULL;
if (i < pyargs_len) {
+ /* New in 2.8x, optional arguments must be keywords. */
+ if (UNLIKELY((flag_parameter & PARM_REQUIRED) == 0)) {
+ PyErr_Format(PyExc_TypeError,
+ "%.200s.%.200s(): required parameter \"%.200s\" to be a keyword argument!",
+ RNA_struct_identifier(self_ptr->type),
+ RNA_function_identifier(self_func),
+ RNA_property_identifier(parm));
+ err = -1;
+ break;
+ }
+
item = PyTuple_GET_ITEM(args, i);
kw_arg = false;
}