UI: errors in buttons now show in info report
Mistakes in button expressions were previously only printed to the console.
This commit is contained in:
@@ -478,6 +478,34 @@ error_cleanup:
|
||||
}
|
||||
#endif
|
||||
|
||||
PyObject *PyC_ExceptionBuffer_Simple(void)
|
||||
{
|
||||
PyObject *string_io_buf;
|
||||
|
||||
PyObject *error_type, *error_value, *error_traceback;
|
||||
|
||||
if (!PyErr_Occurred())
|
||||
return NULL;
|
||||
|
||||
PyErr_Fetch(&error_type, &error_value, &error_traceback);
|
||||
|
||||
if (error_value == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
string_io_buf = PyObject_Str(error_value);
|
||||
/* Python does this too */
|
||||
if (UNLIKELY(string_io_buf == NULL)) {
|
||||
string_io_buf = PyUnicode_FromFormat(
|
||||
"<unprintable %s object>", Py_TYPE(error_value)->tp_name);
|
||||
}
|
||||
|
||||
PyErr_Restore(error_type, error_value, error_traceback);
|
||||
|
||||
PyErr_Print();
|
||||
PyErr_Clear();
|
||||
return string_io_buf;
|
||||
}
|
||||
|
||||
/* string conversion, escape non-unicode chars, coerce must be set to NULL */
|
||||
const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
|
||||
|
||||
@@ -32,6 +32,7 @@ void PyC_ObSpit(const char *name, PyObject *var);
|
||||
void PyC_LineSpit(void);
|
||||
void PyC_StackSpit(void);
|
||||
PyObject * PyC_ExceptionBuffer(void);
|
||||
PyObject * PyC_ExceptionBuffer_Simple(void);
|
||||
PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
|
||||
PyObject * PyC_FrozenSetFromStrings(const char **strings);
|
||||
PyObject * PyC_Err_Format_Prefix(PyObject *exception_type_prefix, const char *format, ...);
|
||||
|
||||
Reference in New Issue
Block a user