diff options
Diffstat (limited to 'Python/tracemalloc.c')
-rw-r--r-- | Python/tracemalloc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/tracemalloc.c b/Python/tracemalloc.c index bc76562..f8ad939 100644 --- a/Python/tracemalloc.c +++ b/Python/tracemalloc.c @@ -249,6 +249,7 @@ hashtable_compare_traceback(const void *key1, const void *key2) static void tracemalloc_get_frame(_PyInterpreterFrame *pyframe, frame_t *frame) { + assert(PyCode_Check(pyframe->f_executable)); frame->filename = &_Py_STR(anon_unknown); int lineno = PyUnstable_InterpreterFrame_GetLine(pyframe); if (lineno < 0) { @@ -256,7 +257,7 @@ tracemalloc_get_frame(_PyInterpreterFrame *pyframe, frame_t *frame) } frame->lineno = (unsigned int)lineno; - PyObject *filename = pyframe->f_code->co_filename; + PyObject *filename = filename = ((PyCodeObject *)pyframe->f_executable)->co_filename; if (filename == NULL) { #ifdef TRACE_DEBUG |