[Python-Dev] Encoding of PyFrameObject members

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Feb 7 22:34:03 CET 2015


Maciej Fijalkowski wrote:
> However, you can't access thread
> locals from signal handlers (since in some cases it mallocs, thread
> locals are built lazily if you're inside the .so, e.g. if python is
> built with --shared)

You might be able to use Py_AddPendingCall to schedule
what you want done outside the context of the signal
handler.

The call will be made by the main thread, though,
so if you need to access the frame of whatever thread
was running when the signal occured, you will have
to track down its PyThreadState somehow and get the
frame from there. Not sure what would be involved
in doing that.

-- 
Greg


More information about the Python-Dev mailing list