diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-11-05 01:36:46 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-11-05 01:36:46 +0300 |
commit | e6ea68a31cf800f903653495fc7cdd09bde965f2 (patch) | |
tree | 1a2a4c53b2590f9c85e1caaab7df5b028a3fc85e /source/blender | |
parent | 08bbda500530e89b1a0f18006a248529e858511b (diff) |
- missing return values
- more detailed exceptions (always give file:line incase the python exception doesnt)
- fix some errors in the edit docs
editing docs still fails, need to figure out why.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/python/intern/bpy_operator_wrap.c | 4 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_util.c | 16 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 4 |
3 files changed, 17 insertions, 7 deletions
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index b0754ee1cde..95ffd3e1121 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -178,8 +178,10 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperatorType *ot, wmOperat } else if (BPY_flag_from_seq(pyop_ret_flags, ret, &ret_flag) == -1) { /* the returned value could not be converted into a flag */ - if(op) + if(op) { + fprintf(stderr, "error using return value from \"%s\"\n", op->idname); // for some reason the error raised doesnt include file:line... this helps BPy_errors_to_report(op->reports); + } ret_flag = OPERATOR_CANCELLED; } diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c index 1766be62c83..86407e0c818 100644 --- a/source/blender/python/intern/bpy_util.c +++ b/source/blender/python/intern/bpy_util.c @@ -69,7 +69,7 @@ static char *bpy_flag_error_str(BPY_flag_def *flagdef) BLI_dynstr_appendf(dynstr, fd!=flagdef?", '%s'":"'%s'", fd->name); fd++; } - + cstring = BLI_dynstr_get_cstring(dynstr); BLI_dynstr_free(dynstr); return cstring; @@ -414,7 +414,10 @@ int BPy_errors_to_report(ReportList *reports) { PyObject *pystring; char *cstring; - + + char *filename; + int lineno; + if (!PyErr_Occurred()) return 1; @@ -432,10 +435,15 @@ int BPy_errors_to_report(ReportList *reports) return 0; } + BPY_getFileAndNum(&filename, &lineno); + cstring= _PyUnicode_AsString(pystring); - BKE_report(reports, RPT_ERROR, cstring); - fprintf(stderr, "%s\n", cstring); // not exactly needed. just for testing + BKE_reportf(reports, RPT_ERROR, "%s\nlocation:%s:%d\n", cstring, filename, lineno); + + fprintf(stderr, "%s\nlocation:%s:%d\n", cstring, filename, lineno); // not exactly needed. just for testing + Py_DECREF(pystring); return 1; } + diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index db09619046e..35e02d86b08 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2470,9 +2470,9 @@ static EnumPropertyItem *rna_id_itemf(bContext *C, PointerRNA *ptr, int *free, I /* can add more */ EnumPropertyItem *RNA_group_itemf(bContext *C, PointerRNA *ptr, int *free) { - rna_id_itemf(C, ptr, free, (ID *)CTX_data_main(C)->group.first); + return rna_id_itemf(C, ptr, free, (ID *)CTX_data_main(C)->group.first); } EnumPropertyItem *RNA_scene_itemf(bContext *C, PointerRNA *ptr, int *free) { - rna_id_itemf(C, ptr, free, (ID *)CTX_data_main(C)->scene.first); + return rna_id_itemf(C, ptr, free, (ID *)CTX_data_main(C)->scene.first); } |