new function RNA_warning(), replaces printf with function which may be called via python.
Now this gives the line number of the scripts thats running, eg: uiItemFullO: unknown operator 'some.operator' /c/bin/2.56/scripts/startup/bl_ui/space_view3d_toolbar.py:73
This commit is contained in:
@@ -30,6 +30,8 @@
|
||||
|
||||
#include "py_capi_utils.h"
|
||||
|
||||
#define PYC_INTERPRETER_ACTIVE (((PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current)) != NULL)
|
||||
|
||||
/* for debugging */
|
||||
void PyC_ObSpit(const char *name, PyObject *var) {
|
||||
fprintf(stderr, "<%s> : ", name);
|
||||
@@ -51,9 +53,16 @@ void PyC_ObSpit(const char *name, PyObject *var) {
|
||||
}
|
||||
|
||||
void PyC_LineSpit(void) {
|
||||
|
||||
const char *filename;
|
||||
int lineno;
|
||||
|
||||
/* Note, allow calling from outside python (RNA) */
|
||||
if(!PYC_INTERPRETER_ACTIVE) {
|
||||
fprintf(stderr, "python line lookup failed, interpreter inactive\n");
|
||||
return;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
PyC_FileAndNum(&filename, &lineno);
|
||||
|
||||
|
||||
@@ -47,4 +47,5 @@ void PyC_RunQuicky(const char *filepath, int n, ...);
|
||||
|
||||
void PyC_MainModule_Backup(PyObject **main_mod);
|
||||
void PyC_MainModule_Restore(PyObject *main_mod);
|
||||
|
||||
#endif // PY_CAPI_UTILS_H
|
||||
|
||||
Reference in New Issue
Block a user