summaryrefslogtreecommitdiffstats
path: root/Python/tracemalloc.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-06-14 12:46:37 (GMT)
committerGitHub <noreply@github.com>2023-06-14 12:46:37 (GMT)
commit7199584ac8632eab57612f595a7162ab8d2ebbc0 (patch)
treeeda3183876d2ce6805796d5c8f7b0cd8abadc22e /Python/tracemalloc.c
parentad56340b665c5d8ac1f318964f71697bba41acb7 (diff)
downloadcpython-7199584ac8632eab57612f595a7162ab8d2ebbc0.zip
cpython-7199584ac8632eab57612f595a7162ab8d2ebbc0.tar.gz
cpython-7199584ac8632eab57612f595a7162ab8d2ebbc0.tar.bz2
GH-100987: Allow objects other than code objects as the "executable" of an internal frame. (GH-105727)
* Add table describing possible executable classes for out-of-process debuggers. * Remove shim code object creation code as it is no longer needed. * Make lltrace a bit more robust w.r.t. non-standard frames.
Diffstat (limited to 'Python/tracemalloc.c')
-rw-r--r--Python/tracemalloc.c3
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