Victor, thank you for starting this conversation. Nick, I just looked at your 
patch and I think it is a better solution than mine, because it does not 
involve adding to or changing the sys API. I will close my pull request.

The reason for my interest in this area is that I’m experimenting with a code 
coverage tool that does per-opcode tracing. 
I just updated it to use the new f_trace_opcodes feature and it *almost* 
worked: Nick’s implementation calls the opcode trace before updating the line 
number, whereas my version updated line numbers first, so the event stream is 
slightly different.

See: 
https://github.com/python/cpython/commit/5a8516701f5140c8c989c40e261a4f4e20e8af86#diff-7f17c8d8448b7b6f90549035d2147a9f

From my perspective it makes more sense to do the update to f_lineno first, 
followed by the opcode trace, because then line events and opcode events 
corresponding to the same opcode will have the same line number; as it is they 
come out different.

Is the current order intentional? Otherwise I’ll submit a patch.

Either way, I’m really happy that this functionality has made it into master!

Thanks,
George

_______________________________________________
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