[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42977] trunk/blender/source/blender/ python/intern/bpy_rna.c: py - fix for error which made enums not through errors when assigned non string types
Campbell Barton
ideasman42 at gmail.com
Thu Dec 29 15:46:31 CET 2011
Revision: 42977
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42977
Author: campbellbarton
Date: 2011-12-29 14:46:26 +0000 (Thu, 29 Dec 2011)
Log Message:
-----------
py - fix for error which made enums not through errors when assigned non string types
Modified Paths:
--------------
trunk/blender/source/blender/python/intern/bpy_rna.c
Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_rna.c 2011-12-29 13:43:59 UTC (rev 42976)
+++ trunk/blender/source/blender/python/intern/bpy_rna.c 2011-12-29 14:46:26 UTC (rev 42977)
@@ -1118,12 +1118,10 @@
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 @@
"%.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 @@
}
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;
}
}
More information about the Bf-blender-cvs
mailing list