More correct usage of PyErr_Print()

that function can crash if no errors really occurred
This commit is contained in:
Davide Andreoli 2015-09-11 22:49:24 +02:00
parent 81bda2a9ce
commit 6e186dcb85
1 changed files with 6 additions and 2 deletions

View File

@ -73,13 +73,17 @@ static PyObject *edjeEdjeType;
#define PY_ON_ERROR_RETURN(_extra_check_, _ret_val_, _msg_) \
if (PyErr_Occurred() || _extra_check_) { \
if (PyErr_Occurred()) { \
PyErr_Print(); \
PyRun_SimpleString("sys.stdout.flush()"); \
PyRun_SimpleString("sys.stderr.flush()"); \
if (_msg_) DBG("EDGAR: ERROR "_msg_); \
return _ret_val_; \
} \
if (_extra_check_) { \
if (_msg_) DBG("EDGAR: ERROR "_msg_); \
return _ret_val_; \
} \
#if (PY_VERSION_HEX < 0x03030000)
@ -294,7 +298,7 @@ edgar_gadget_unload(Edgar_Py_Gadget *gadget)
// kill all the active popups edje obj
EINA_LIST_FOREACH_SAFE(gadget->pops_obj, l, l2, popup_content)
E_FREE_FUNC(popup_content, evas_object_del);
E_FREE_FUNC(popup_content, evas_object_del);
// Free the gadcon client class
e_gadcon_provider_unregister(gadget->cclass);