On 27 September 2017 at 22:56, Victor Stinner <victor.stinner at gmail.com> wrote: > Hi, > > In bpo-29400, it was proposed to add the ability to trace not only > function calls but also instructions at the bytecode level. I like the > idea, but I don't see how to extend sys.settrace() to add a new > "trace_instructions: bool" optional (keyword-only?) parameter without > breaking the backward compatibility. Should we add a new function > instead? As part of investigating the current signal safety problems in with statements [1], I added the ability to trace lines, opcodes, both, or neither by setting a couple of flags on a per-frame basis: https://docs.python.org/dev/whatsnew/3.7.html#other-cpython-implementation-changes So the idea is that if you want per-opcode tracing, your trace function has to turn it on for each frame when handling the call event, and you accept the responsibility of not messing up the frame stack. Cheers, Nick. [1] See https://bugs.python.org/issue29988 if you're interested in the gory details -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4