On 27 September 2017 at 22:56, Victor Stinner <victor.stin...@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   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to