[Bf-blender-cvs] [dfb63653f4f] master: PyAPI: minor change to bpy.app.debug_value exception handling

Campbell Barton noreply at git.blender.org
Wed Jan 16 22:48:46 CET 2019


Commit: dfb63653f4f084ec8c8b061dd0f33769b16b3b91
Author: Campbell Barton
Date:   Thu Jan 17 08:46:36 2019 +1100
Branches: master
https://developer.blender.org/rBdfb63653f4f084ec8c8b061dd0f33769b16b3b91

PyAPI: minor change to bpy.app.debug_value exception handling

Use error from int conversion function.

===================================================================

M	source/blender/python/intern/bpy_app.c

===================================================================

diff --git a/source/blender/python/intern/bpy_app.c b/source/blender/python/intern/bpy_app.c
index 01c8573f589..fe8eb768b3a 100644
--- a/source/blender/python/intern/bpy_app.c
+++ b/source/blender/python/intern/bpy_app.c
@@ -306,20 +306,16 @@ static PyObject *bpy_app_debug_value_get(PyObject *UNUSED(self), void *UNUSED(cl
 
 static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void *UNUSED(closure))
 {
-	int param = PyC_Long_AsI32(value);
+	short param = PyC_Long_AsI16(value);
 
 	if (param == -1 && PyErr_Occurred()) {
-		PyErr_SetString(PyExc_TypeError, "bpy.app.debug_value can only be set to a whole number");
+		PyC_Err_SetString_Prefix(
+		        PyExc_TypeError,
+		        "bpy.app.debug_value can only be set to a whole number");
 		return -1;
 	}
 
-	if (param < SHRT_MIN || param > SHRT_MAX) {
-		PyErr_SetString(PyExc_ValueError,
-		                "bpy.app.debug_value can only be set to short range [-32768, 32767]");
-		return -1;
-	}
-
-	G.debug_value = (short)param;
+	G.debug_value = param;
 
 	WM_main_add_notifier(NC_WINDOW, NULL);



More information about the Bf-blender-cvs mailing list