[issue42197] Disable automatic update of frame locals during tracing

Fabio Zadrozny report at bugs.python.org
Wed Jan 20 06:30:22 EST 2021


Fabio Zadrozny <fabiofz at gmail.com> added the comment:

I agree that it can be made better, but I think most of the issues right now comes from CPython trying to automatically do something that's not bound to work (calling PyFrame_FastToLocals/PyFrame_LocalsToFast under the hood during the tracing call).

https://bugs.python.org/issue30744 is a great example of why that can never work properly (debuggers need to manage that much more carefully, just doing it on all calls is really bound to not work).

So, the current implementation besides being broken also makes things pretty slow.

I agree that PEP 558 may fix things here (but it's much more work).

As a disclaimer, pydevd actually uses a different tracer which doesn't do those calls and when possible uses the frame eval to modify the bytecode directly to minimize the overhead, so, in practice the current support given by CPython for debugger is pretty reasonable for doing a fast debugger (but there are a few caveats that it must work around -- such as the auto PyFrame_FastToLocals/PyFrame_LocalsToFast calls).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42197>
_______________________________________


More information about the Python-bugs-list mailing list