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:
authorCampbell Barton <ideasman42@gmail.com>2009-11-23 20:36:44 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-23 20:36:44 +0300
commit1c806f6bb454dca6f682ecd741bd2fe03b9617bb (patch)
treea4c2853d8116e9890b9994e6597b3fa5cf38bb52
parente2a5862e8f30a83de7aca5da7b16e9f8ccd3376c (diff)
workaround for an error with BKE_reportf (actually BLI_dynstr_vappendf)
fixes a crash that happens when formatting a python exception into a report. - for now use pythons string formatting function. happens when running the simple operator template so not sure if its worth re-tagging :S
-rw-r--r--source/blender/python/intern/bpy_util.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index 174d1aa342f..cd53ba9c069 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -416,6 +416,7 @@ int BPy_reports_to_error(ReportList *reports)
int BPy_errors_to_report(ReportList *reports)
{
PyObject *pystring;
+ PyObject *pystring_format= NULL; // workaround, see below
char *cstring;
char *filename;
@@ -439,14 +440,23 @@ int BPy_errors_to_report(ReportList *reports)
}
BPY_getFileAndNum(&filename, &lineno);
+ if(filename==NULL)
+ filename= "<unknown location>";
cstring= _PyUnicode_AsString(pystring);
-
+
+#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);
+#else
+ pystring_format= PyUnicode_FromFormat("%s\nlocation:%s:%d\n", cstring, filename, lineno);
+ cstring= _PyUnicode_AsString(pystring_format);
+ BKE_report(reports, RPT_ERROR, cstring);
+#endif
fprintf(stderr, "%s\nlocation:%s:%d\n", cstring, filename, lineno); // not exactly needed. just for testing
Py_DECREF(pystring);
+ Py_DECREF(pystring_format); // workaround
return 1;
}