<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 25 Apr 2019, at 15:51, Ram Rachum <<a href="mailto:ram@rachum.com" class="">ram@rachum.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi,<div class=""><br class=""></div><div class="">Here's something I want in Python: Multiple levels of tracers working on top of each other, instead of just one. </div><div class=""><br class=""></div><div class="">I'm talking about the tracer that one can set by calling sys.settrace.</div><div class=""><br class=""></div><div class="">I've recently released PySnooper: <a href="https://github.com/cool-RR/PySnooper/" class="">https://github.com/cool-RR/PySnooper/</a></div><div class=""><br class=""></div><div class="">One of the difficulties I have, is that I can't debug or run the `coverage` tool on the core of this module. That's because the core is a trace function, and debuggers and coverage tools work by setting a trace function. When PySnooper sets its trace function using `sys.settrace`, the code that runs in that trace function runs without getting traced by the coverage tracer.</div><div class=""><br class=""></div><div class="">This means that people who develop debuggers and coverage tools can't use a debugger or a coverage tool on the core of their tool. It's quite an annoying problem.</div><div class=""><br class=""></div><div class="">My proposed solution: Multiple levels of tracing, instead of just one. When you install a tracer, you're not replacing the existing one, you're appending a tracer to the existing list of tracers.</div><div class=""><br class=""></div><div class="">If this was implemented, then when PySnooper would install its tracer, the coverage tracer would still be active and running, for every line of code including the ones in PySnooper's tracer.</div><div class=""><br class=""></div><div class="">Obviously, we'll need to figure out the API and any other kind of problems with this proposal.</div><div class=""><br class=""></div><div class="">What do you think? </div></div></div></blockquote><div><br class=""></div><div>Personally I would look to other means to get the coverage report for a tracing tool</div><div>or debugger.</div><div><br class=""></div><div>For example why not use unittesting and mocking to allow the trace code to be run</div><div>and measured? After all you only have to mock for one functions interface.</div><div><br class=""></div><div>As for debugging I would use print() or logging to find what I need.</div><div><br class=""></div><div>Barry</div><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Ram.</div><div class=""><br class=""></div><div class=""><br class=""></div></div>
_______________________________________________<br class="">Python-ideas mailing list<br class=""><a href="mailto:Python-ideas@python.org" class="">Python-ideas@python.org</a><br class="">https://mail.python.org/mailman/listinfo/python-ideas<br class="">Code of Conduct: http://python.org/psf/codeofconduct/<br class=""></div></blockquote></div><br class=""></body></html>