25 #include "../generic/py_capi_utils.h"
38 PyErr_SetString(exception, report_str);
42 return (report_str ==
NULL) ? 0 : -1;
48 PySys_WriteStdout(
"%s\n", header);
52 PySys_WriteStdout(
"%s: %s\n", report->typestr, report->message);
57 const char *err_prefix,
59 const bool use_location)
62 if (!PyErr_Occurred()) {
67 if (err_str_py ==
NULL) {
73 Py_ssize_t err_str_len;
74 const char *err_str = PyUnicode_AsUTF8AndSize(err_str_py, &err_str_len);
75 while (err_str_len > 0 && err_str[err_str_len - 1] ==
'\n') {
79 if (err_prefix ==
NULL) {
81 err_prefix =
"Python";
84 const char *location_filepath =
NULL;
85 int location_line_number = -1;
92 if (location_filepath) {
102 location_line_number);
109 Py_DECREF(err_str_py);
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_reports_clear(ReportList *reports)
void BKE_report(ReportList *reports, eReportType type, const char *message)
char * BKE_reports_string(ReportList *reports, eReportType level)
A dynamically sized string ADT.
#define LISTBASE_FOREACH(type, var, list)
Read Guarded memory(de)allocation.
void BPy_reports_write_stdout(const ReportList *reports, const char *header)
short BPy_reports_to_error(ReportList *reports, PyObject *exception, const bool clear)
bool BPy_errors_to_report_ex(ReportList *reports, const char *err_prefix, const bool use_full, const bool use_location)
bool BPy_errors_to_report(ReportList *reports)
void(* MEM_freeN)(void *vmemh)
static void clear(Message *msg)
PyObject * PyC_ExceptionBuffer(void)
PyObject * PyC_ExceptionBuffer_Simple(void)
void PyC_FileAndNum(const char **r_filename, int *r_lineno)