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:
authorMichel Selten <michel@mselten.demon.nl>2003-06-22 22:34:36 +0400
committerMichel Selten <michel@mselten.demon.nl>2003-06-22 22:34:36 +0400
commitd253eb4b757ac5f01c01201815cb3db0c7308d33 (patch)
tree95ff32031d2134ad2260737663e02cc047d9f447 /source/blender/python/BPY_interface.c
parent85f580433327c6be84e2fcc57a555ae251fb9b8a (diff)
* Fixes segfault caused in the Object.getParent function.
Found by Jonathan Thambidurai * Fixes a scriptlink problem when a script is run using ALT-p. Found by Yann Vernier (LoneTech) * Prints unhandled exceptions. Should fix some memory leaks too. Fixed by Yann Verniet (LoneTech)
Diffstat (limited to 'source/blender/python/BPY_interface.c')
-rw-r--r--source/blender/python/BPY_interface.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c
index 2dff0d1b0e1..bf58a417c63 100644
--- a/source/blender/python/BPY_interface.c
+++ b/source/blender/python/BPY_interface.c
@@ -240,6 +240,8 @@ struct _object *BPY_txt_do_python(struct SpaceText* st)
else
dict = PyModule_GetDict(PyImport_AddModule("__main__"));
+ clearScriptLinks ();
+
ret = RunPython (st->text, dict); /* Run the script */
if (!ret) { /* Failed execution of the script */
@@ -353,6 +355,7 @@ void BPY_do_pyscript(struct ID *id, short event)
ScriptLink * scriptlink;
int index;
PyObject * dict;
+ PyObject * ret;
printf ("In BPY_do_pyscript(id=%s, event=%d)\n",id->name, event);
@@ -368,8 +371,19 @@ void BPY_do_pyscript(struct ID *id, short event)
(scriptlink->scripts[index] != NULL))
{
dict = CreateGlobalDictionary();
- RunPython ((Text*) scriptlink->scripts[index], dict);
+ ret = RunPython ((Text*) scriptlink->scripts[index], dict);
ReleaseGlobalDictionary (dict);
+ if (!ret)
+ {
+ /* Failed execution of the script */
+ BPY_Err_Handle ((Text*) scriptlink->scripts[index]);
+ BPY_end_python ();
+ BPY_start_python ();
+ }
+ else
+ {
+ Py_DECREF (ret);
+ }
}
}