diff options
author | Victor Stinner <vstinner@python.org> | 2025-01-21 13:43:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-21 13:43:31 (GMT) |
commit | 31f149d5b3a5c6cb1160a052c96a35c36f2a27db (patch) | |
tree | 7783adfd746c3a1662b260120274ce5b323a7d95 /Python/tracemalloc.c | |
parent | 6a0f915aaea869cae799349047eef6f9f3c6e2dc (diff) | |
download | cpython-31f149d5b3a5c6cb1160a052c96a35c36f2a27db.zip cpython-31f149d5b3a5c6cb1160a052c96a35c36f2a27db.tar.gz cpython-31f149d5b3a5c6cb1160a052c96a35c36f2a27db.tar.bz2 |
gh-128679: Use _PyThreadState_GET() in tracemalloc.c (#129126)
Replace uncommon PyGILState_GetThisThreadState() with common
_PyThreadState_GET().
Diffstat (limited to 'Python/tracemalloc.c')
-rw-r--r-- | Python/tracemalloc.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/Python/tracemalloc.c b/Python/tracemalloc.c index a9f45e5..b398ea3 100644 --- a/Python/tracemalloc.c +++ b/Python/tracemalloc.c @@ -338,13 +338,8 @@ traceback_hash(traceback_t *traceback) static void traceback_get_frames(traceback_t *traceback) { - PyThreadState *tstate = PyGILState_GetThisThreadState(); - if (tstate == NULL) { -#ifdef TRACE_DEBUG - tracemalloc_error("failed to get the current thread state"); -#endif - return; - } + PyThreadState *tstate = _PyThreadState_GET(); + assert(tstate != NULL); _PyInterpreterFrame *pyframe = _PyThreadState_GetFrame(tstate); while (pyframe) { |