[Python-Dev] What is the purpose of the _PyThreadState_Current symbol in Python 3?

Gabriele phoenix1987 at gmail.com
Wed Sep 26 17:01:17 EDT 2018

In trying to find the location of a valid instance of PyInterpreterState in
the virtual memory of a running Python (3.6) application (using
process_vm_read on Linux), I have noticed that I can only rely on
_PyThreadState_Current.interp at the very beginning of the execution. If I
try to attach to a running Python process, then
_PythreadState_Current.interp doesn't seem to point to anything useful to
derive the currently running threads and the frame stacks for each of them.
This makes me wonder about the purpose of this symbol in the
.dynsym section. Apart from a brute force approach for finding a valid
PyInterpreterState, is there a more reliable approach for the version of
Python that I'm targeting?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20180926/1d95144d/attachment.html>

More information about the Python-Dev mailing list