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>2011-12-29 18:46:26 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-29 18:46:26 +0400
commit4f0b7e8c6ae7336e77c7b360d279e5c69ddfaaab (patch)
tree1a7e7378f46d95b268970832c42ce474b9595270 /source/blender/python
parent5ed0cd4ad79b3195393a8d88f5b84c0d37a33982 (diff)
py - fix for error which made enums not through errors when assigned non string types
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/intern/bpy_rna.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index b23db759603..d911fcb99b1 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1118,12 +1118,10 @@ static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *pr
const char *param = _PyUnicode_AsString(item);
if (param == NULL) {
- const char *enum_str = pyrna_enum_as_string(ptr, prop);
PyErr_Format(PyExc_TypeError,
- "%.200s expected a string enum type in (%.200s)",
- error_prefix, enum_str);
- MEM_freeN((void *)enum_str);
- return 0;
+ "%.200s expected a string enum, not %.200s",
+ error_prefix, Py_TYPE(item)->tp_name);
+ return -1;
}
else {
/* hack so that dynamic enums used for operator properties will be able to be built (i.e. context will be supplied to itemf)
@@ -1136,11 +1134,11 @@ static int pyrna_string_to_enum(PyObject *item, PointerRNA *ptr, PropertyRNA *pr
"%.200s enum \"%.200s\" not found in (%.200s)",
error_prefix, param, enum_str);
MEM_freeN((void *)enum_str);
- return 0;
+ return -1;
}
}
- return 1;
+ return 0;
}
/* 'value' _must_ be a set type, error check before calling */
@@ -1652,7 +1650,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
}
else {
/* simple enum string */
- if (!pyrna_string_to_enum(value, ptr, prop, &val, error_prefix) < 0) {
+ if (pyrna_string_to_enum(value, ptr, prop, &val, error_prefix) < 0) {
return -1;
}
}