line_profiler
line_profiler copied to clipboard
Enable tracing for all threads.
PyEval_SetTrace only sets the current thread's tracing callback. This patch makes enable_count thread-local, so that tracing is enabled/disabled on a thread-specific basis. Without this, only the thread that happened to trigger the enable() call would have had tracing enabled.
Tested and works for me.
Works for me too. This is also very short patch so hopefully not too hard to review. In today's world where many programs need multiple threads, supporting profiling multiple threads is very useful.
After four years, I am also surprised that this has not been merged. It has been used for a number of my multithreaded projects, and it painful to carry around a non-pip version.
Pinging @rkern ...