forked from bartvdbraak/blender
bug fix: sigsegv when script had syntax errors
This commit is contained in:
parent
9edf1c08a6
commit
609f5b7f9c
@ -175,7 +175,7 @@ void BPY_Err_Handle(Text *text)
|
||||
PyErr_Restore(exception, err, tb); // takes away reference!
|
||||
PyErr_Print();
|
||||
tb = PySys_GetObject("last_traceback");
|
||||
Py_INCREF(tb);
|
||||
Py_XINCREF(tb);
|
||||
|
||||
/* From old bpython BPY_main.c:
|
||||
* 'check traceback objects and look for last traceback in the
|
||||
@ -186,9 +186,11 @@ void BPY_Err_Handle(Text *text)
|
||||
while (1) {
|
||||
v = PyObject_GetAttrString(tb, "tb_next");
|
||||
|
||||
if (v == Py_None ||
|
||||
strcmp(PyString_AsString(traceback_getFilename(v)), GetName(text)))
|
||||
if (v == Py_None || strcmp(PyString_AsString(traceback_getFilename(v)),
|
||||
GetName(text))) {
|
||||
break;
|
||||
}
|
||||
|
||||
Py_DECREF(tb);
|
||||
tb = v;
|
||||
}
|
||||
@ -482,8 +484,6 @@ PyObject * RunPython(Text *text, PyObject *globaldict)
|
||||
|
||||
if (PyErr_Occurred()) {
|
||||
BPY_free_compiled_text(text);
|
||||
PyErr_SetString (PyExc_RuntimeError,
|
||||
"couldn't compile script to Python bytecode");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user