diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-12-31 13:15:29 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-12-31 13:20:41 +0300 |
commit | 0ffc603553bb6a5dd3ce96e88bc9be34356fc0cf (patch) | |
tree | 1415890bf433ac933fee88fb80e37c322e26e281 /source/blender/python/generic/py_capi_utils.c | |
parent | 16e1bbf1dbbefde14533b0de5b68ae3ac269e05c (diff) |
Cleanup: Py API naming
Use BPY_execute_* prefix for all Python execution commands
Diffstat (limited to 'source/blender/python/generic/py_capi_utils.c')
-rw-r--r-- | source/blender/python/generic/py_capi_utils.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 89c3ed2460e..dd32c913f78 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -971,14 +971,14 @@ PyObject *PyC_FlagSet_FromBitfield(PyC_FlagSet *items, int flag) /** - * \return -1 on error, else 0 + * \return success * * \note it is caller's responsibility to acquire & release GIL! */ -int PyC_RunString_AsNumber(const char *expr, double *value, const char *filename) +bool PyC_RunString_AsNumber(const char *expr, double *value, const char *filename) { PyObject *py_dict, *mod, *retval; - int error_ret = 0; + bool ok = true; PyObject *main_mod = NULL; PyC_MainModule_Backup(&main_mod); @@ -998,7 +998,7 @@ int PyC_RunString_AsNumber(const char *expr, double *value, const char *filename retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict); if (retval == NULL) { - error_ret = -1; + ok = false; } else { double val; @@ -1024,7 +1024,7 @@ int PyC_RunString_AsNumber(const char *expr, double *value, const char *filename Py_DECREF(retval); if (val == -1 && PyErr_Occurred()) { - error_ret = -1; + ok = false; } else if (!finite(val)) { *value = 0.0; @@ -1036,7 +1036,7 @@ int PyC_RunString_AsNumber(const char *expr, double *value, const char *filename PyC_MainModule_Restore(main_mod); - return error_ret; + return ok; } #endif /* #ifndef MATH_STANDALONE */ |