Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-03-02 23:18:29 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-03-02 23:18:29 +0300
commitc2fdac64c4eed74a146507c3e3d0b8b5f3183174 (patch)
tree6863689031a01d1728d0a7ae7d3beb0d1e3b69e8 /source/blender/python/intern
parent24e8d7aa749a8e52abff4b06f3ded6ae01625b02 (diff)
* errors in bpyui draw scripts were segfaulting
* added PyLineSpit(), useful for debugging so you can easily find the line of the python script running.
Diffstat (limited to 'source/blender/python/intern')
-rw-r--r--source/blender/python/intern/bpy_interface.c6
-rw-r--r--source/blender/python/intern/bpy_util.c10
-rw-r--r--source/blender/python/intern/bpy_util.h1
3 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index fcf748c6887..7a460f93e67 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -168,10 +168,11 @@ int BPY_run_script_space_draw(bContext *C, SpaceScript * sc)
if (bpy_run_script_init(C, sc)) {
PyGILState_STATE gilstate = PyGILState_Ensure();
PyObject *result = PyObject_CallObject( sc->script->py_draw, NULL );
- PyGILState_Release(gilstate);
if (result==NULL)
exit_pydraw(sc, 1);
+
+ PyGILState_Release(gilstate);
}
return 1;
}
@@ -183,10 +184,11 @@ int BPY_run_script_space_listener(bContext *C, SpaceScript * sc)
PyGILState_STATE gilstate = PyGILState_Ensure();
PyObject *result = PyObject_CallObject( sc->script->py_draw, NULL );
- PyGILState_Release(gilstate);
if (result==NULL)
exit_pydraw(sc, 1);
+
+ PyGILState_Release(gilstate);
}
return 1;
}
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index 31d15d8a69e..8bdb6334a91 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -162,6 +162,16 @@ void PyObSpit(char *name, PyObject *var) {
fprintf(stderr, "\n");
}
+void PyLineSpit(void) {
+ char filename[512];
+ int lineno;
+
+ PyErr_Clear();
+ BPY_getFileAndNum(&filename, &lineno);
+
+ fprintf(stderr, "%s:%d\n", filename, lineno);
+}
+
void BPY_getFileAndNum(char **filename, int *lineno)
{
PyObject *getframe, *frame;
diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h
index 4b0af975025..4d4d552af4e 100644
--- a/source/blender/python/intern/bpy_util.h
+++ b/source/blender/python/intern/bpy_util.h
@@ -35,4 +35,5 @@ PyObject *BPY_flag_to_list(BPY_flag_def *flagdef, int flag);
int BPY_flag_from_seq(BPY_flag_def *flagdef, PyObject *seq, int *flag);
void PyObSpit(char *name, PyObject *var);
+void PyLineSpit(void);
void BPY_getFileAndNum(char **filename, int *lineno);