[issue9622] Allow to set profile/trace function globally

Kristján Valur Jónsson report at bugs.python.org
Tue Aug 17 22:45:50 CEST 2010


Kristján Valur Jónsson <kristjan at ccpgames.com> added the comment:

I just realized that this is probably a redundant change.
We have C apis to get all the Thread states in an interpreter state (I didn't even know there was such a thing as multiple interpreter states, but there!)
This is the PyInterpreterState_ThreadHead() api et al.
>From C, all that is missing is a SetTrace api that takes a thread state.

>From python, the threading module provides access to all Thread objects, and each of those has a settrace/setprofile method.

To turn on global tracing from cProfile, all that is needed is to iterate over all the Thread objects.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9622>
_______________________________________


More information about the Python-bugs-list mailing list