This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: sys.settrace inheritance
Type: enhancement Stage:
Components: None Versions:
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: draghuram, majid
Priority: normal Keywords:

Created on 2001-09-19 00:29 by majid, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Messages (2)
msg61070 - (view) Author: Fazal Majid (majid) Date: 2001-09-19 00:29
I am trying to perform test coverage analysis on Corba
servers implemented in Python using omniORB, an
excellent open-source Corba ORB from AT&T (formerly
Oracle-Olivetti) labs in Cambridge, UK.

I am using for this purpose a modified version of Neil
Schemenauer's module, which works by
using sys.settrace to set a profiling function.

Unfortunately, new threads do not inherit the trace
function set for the parent thread, which means I am
not profiling the actual work that gets done in Corba
requests :-(

It would be useful to make an option to inherit
sys_tracefunc in PyThreadState_New an option so
multi-threaded programs can be traced/debugged more
easily. I know Fred Drake is reworking the trace
framework to allow profilers written in C, but I am not
sure if this will address this issue.

I can work around this problem by patching omniORB or
PyThreadState_new to copy and INCREF the trace function
every time a new thread is created by the C++ code, but
I would much prefer a more general solution that could
be contributed back to the standard Python code base.
Perhaps what is really needed is the ability to hook
Python thread startup.


-- Fazal Majid
msg61524 - (view) Author: Raghuram Devarakonda (draghuram) (Python triager) Date: 2008-01-22 19:37
I haven't used settrace() functionality myself but a quick test using
latest python shows that trace function set with sys.settrace() is not
inherited by newly created threads.

I am closing this as there is no activity for long time.
Date User Action Args
2022-04-10 16:04:27adminsetgithub: 35198
2008-01-22 19:37:05draghuramsetstatus: open -> closed
resolution: rejected
messages: + msg61524
nosy: + draghuram
2001-09-19 00:29:49majidcreate