[Bf-blender-cvs] [976f14fbcf7] master: PyAPI: replace checks for invalid input w/ assert
Campbell Barton
noreply at git.blender.org
Fri Aug 31 06:45:26 CEST 2018
Commit: 976f14fbcf78a87011ec09e76573cc62b44b6da6
Author: Campbell Barton
Date: Fri Aug 31 14:51:59 2018 +1000
Branches: master
https://developer.blender.org/rB976f14fbcf78a87011ec09e76573cc62b44b6da6
PyAPI: replace checks for invalid input w/ assert
Was returning -1 as a bool argument,
in this case the caller needs to ensure non-null args.
===================================================================
M source/blender/python/intern/bpy_interface.c
===================================================================
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 66abc017fe1..9b685d5ba6e 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -625,13 +625,10 @@ bool BPY_execute_string_as_number(bContext *C, const char *expr, const bool verb
*/
bool BPY_execute_string_as_string(bContext *C, const char *expr, const bool verbose, char **r_value)
{
+ BLI_assert(r_value && expr);
PyGILState_STATE gilstate;
bool ok = true;
- if (!r_value || !expr) {
- return -1;
- }
-
if (expr[0] == '\0') {
*r_value = NULL;
return ok;
@@ -662,13 +659,10 @@ bool BPY_execute_string_as_string(bContext *C, const char *expr, const bool verb
*/
bool BPY_execute_string_as_intptr(bContext *C, const char *expr, const bool verbose, intptr_t *r_value)
{
+ BLI_assert(r_value && expr);
PyGILState_STATE gilstate;
bool ok = true;
- if (!r_value || !expr) {
- return -1;
- }
-
if (expr[0] == '\0') {
*r_value = 0;
return ok;
@@ -694,14 +688,13 @@ bool BPY_execute_string_as_intptr(bContext *C, const char *expr, const bool verb
bool BPY_execute_string_ex(bContext *C, const char *expr, bool use_eval)
{
+ BLI_assert(expr);
PyGILState_STATE gilstate;
PyObject *main_mod = NULL;
PyObject *py_dict, *retval;
bool ok = true;
Main *bmain_back; /* XXX, quick fix for release (Copy Settings crash), needs further investigation */
- if (!expr) return -1;
-
if (expr[0] == '\0') {
return ok;
}
More information about the Bf-blender-cvs
mailing list