summaryrefslogtreecommitdiffstats
path: root/Modules/_tracemalloc.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-25 18:52:02 (GMT)
committerGitHub <noreply@github.com>2020-03-25 18:52:02 (GMT)
commit3072338642156a5edfa2deef2557288fff73c22a (patch)
treec29ba9ddba31386c699a6e7a7417287e519a3158 /Modules/_tracemalloc.c
parent89a2209ae6fc5f39868621799730e16f931eb497 (diff)
downloadcpython-3072338642156a5edfa2deef2557288fff73c22a.zip
cpython-3072338642156a5edfa2deef2557288fff73c22a.tar.gz
cpython-3072338642156a5edfa2deef2557288fff73c22a.tar.bz2
bpo-39947: Use PyThreadState_GetFrame() (GH-19159)
_tracemalloc.c and _xxsubinterpretersmodule.c use PyThreadState_GetFrame() and PyThreadState_GetInterpreter() to no longer depend on the PyThreadState structure.
Diffstat (limited to 'Modules/_tracemalloc.c')
-rw-r--r--Modules/_tracemalloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c
index 74c09e4..bef44db 100644
--- a/Modules/_tracemalloc.c
+++ b/Modules/_tracemalloc.c
@@ -445,7 +445,8 @@ traceback_get_frames(traceback_t *traceback)
return;
}
- for (pyframe = tstate->frame; pyframe != NULL; pyframe = pyframe->f_back) {
+ pyframe = PyThreadState_GetFrame(tstate);
+ for (; pyframe != NULL; pyframe = pyframe->f_back) {
if (traceback->nframe < _Py_tracemalloc_config.max_nframe) {
tracemalloc_get_frame(pyframe, &traceback->frames[traceback->nframe]);
assert(traceback->frames[traceback->nframe].filename != NULL);