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:
Diffstat (limited to 'source/blender/python/intern/bpy_util.c')
-rw-r--r--source/blender/python/intern/bpy_util.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index 5846ccd8757..e876adfa58e 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -85,7 +85,6 @@ short BPy_reports_to_error(ReportList *reports, PyObject *exception, const bool
bool BPy_errors_to_report_ex(ReportList *reports, const bool use_full, const bool use_location)
{
PyObject *pystring;
- const char *cstring;
if (!PyErr_Occurred())
return 1;
@@ -109,13 +108,12 @@ bool BPy_errors_to_report_ex(ReportList *reports, const bool use_full, const boo
return 0;
}
- cstring = _PyUnicode_AsString(pystring);
-
if (use_location) {
const char *filename;
int lineno;
PyObject *pystring_format; /* workaround, see below */
+ const char *cstring;
PyC_FileAndNum(&filename, &lineno);
if (filename == NULL) {
@@ -123,19 +121,23 @@ bool BPy_errors_to_report_ex(ReportList *reports, const bool use_full, const boo
}
#if 0 /* ARG!. workaround for a bug in blenders use of vsnprintf */
- BKE_reportf(reports, RPT_ERROR, "%s\nlocation: %s:%d\n", cstring, filename, lineno);
+ BKE_reportf(reports, RPT_ERROR, "%s\nlocation: %s:%d\n", _PyUnicode_AsString(pystring), filename, lineno);
#else
- pystring_format = PyUnicode_FromFormat(TIP_("%s\nlocation: %s:%d\n"), cstring, filename, lineno);
+ pystring_format = PyUnicode_FromFormat(
+ TIP_("%s\nlocation: %s:%d\n"),
+ _PyUnicode_AsString(pystring), filename, lineno);
+
cstring = _PyUnicode_AsString(pystring_format);
BKE_report(reports, RPT_ERROR, cstring);
- Py_DECREF(pystring_format); /* workaround */
-#endif
/* not exactly needed. just for testing */
fprintf(stderr, TIP_("%s\nlocation: %s:%d\n"), cstring, filename, lineno);
+
+ Py_DECREF(pystring_format); /* workaround */
+#endif
}
else {
- BKE_report(reports, RPT_ERROR, cstring);
+ BKE_report(reports, RPT_ERROR, _PyUnicode_AsString(pystring));
}