Cleanup: Pass 'FILE *' instead of 'void *' for BPY_python_backtrace
This was committed as a temporary workaround in 82150f5641
as release builds were failing (only debug builds worked).
This adds `stdio.h` to the header which is now split into a file that
contains more specialized functionality.
Also move function body inside BPY_python_backtrace,
removing PyC_StackPrint as we have PyC_StackSpit() for
similar functionality that can be called from a debugger.
This commit is contained in:
@@ -382,20 +382,6 @@ void PyC_StackSpit(void)
|
||||
PyGILState_Release(gilstate);
|
||||
}
|
||||
|
||||
void PyC_StackPrint(/* FILE */ void *fp)
|
||||
{
|
||||
PyThreadState *tstate = PyGILState_GetThisThreadState();
|
||||
if (tstate != NULL && tstate->frame != NULL) {
|
||||
PyFrameObject *frame = tstate->frame;
|
||||
do {
|
||||
const int line = PyCode_Addr2Line(frame->f_code, frame->f_lasti);
|
||||
const char *filename = _PyUnicode_AsString(frame->f_code->co_filename);
|
||||
const char *funcname = _PyUnicode_AsString(frame->f_code->co_name);
|
||||
fprintf(fp, " File \"%s\", line %d in %s\n", filename, line, funcname);
|
||||
} while ((frame = frame->f_back));
|
||||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
Reference in New Issue
Block a user