On Thu, Oct 29, 2020 at 9:45 AM Victor Stinner <vstinner@python.org> wrote:
Le jeu. 29 oct. 2020 à 13:02, Fabio Zadrozny <fabiofz@gmail.com> a écrit :
> Debuggers can call  `PyFrame_LocalsToFast` when needed -- otherwise mutating non-current frames doesn't work anyways. As a note, pydevd already has such a call: https://github.com/fabioz/PyDev.Debugger/blob/0d4d210f01a1c0a8647178b2e665b53ab113509d/_pydevd_bundle/pydevd_save_locals.py#L57 and PyPy also has a counterpart.

Hum, if a trace or profile function is written in Python, reading
frame.f_locals does call PyFrame_FastToLocalsWithError(). So a Python
debugger/profiler would be ok with your code.

For a debugger/profiler written in C, it would be a backward
incompatible change. I agree that it would be reasonable to require it
to call PyFrame_FastToLocalsWithError().

> If it's non controversial, is a PEP needed or just an issue to track it would be enough to remove those 2 lines?

Incompatible changes should be well documented in What's New in Python
3.10. In this case, I don't think that a deprecation period is needed.

Just open an issue. Please post the URL to your issue in reply to your
email. It's even better if you can write a PR to implement your idea
;-)


Ok, I've created https://bugs.python.org/issue42197 to track it.

--
Fabio