sys.settrace for all threads
Martin v. Loewis
martin at v.loewis.de
Fri Oct 4 17:52:57 EDT 2002
richie at entrian.com (Richie Hindle) writes:
> Is there a cleaner and more future-proof way of doing this?
No. Your approach won't work very well, either, since threads can come
out nowhere: A C module may create threads, and just temporarily enter
Python from the thread.
If you want to hook into all threads, you need to hook into
PyThreadState_New and friends.
If you want a future-proof way, I recommend to create a
per-interpreter state global, and hook into all places that use the
trace function. You might want to try writing a PEP to generalize this
feature.
Regards,
Martin
More information about the Python-list
mailing list