
On Sat, 30 Jan 2021, 10:55 pm Nick Coghlan, <ncoghlan@gmail.com> wrote:
On Sat, 30 Jan 2021, 10:18 pm Mark Shannon, <mark@hotpy.org> wrote:
The break in compatibility with locals() seems much more intrusive, yet you are OK with that (as am I).
PyEval_GetLocals() is part of the stable ABI and returns a borrowed reference. That means there are a lot of implementation restrictions around keeping that API working. A follow-up PEP could propose deprecating and removing the API as intrinsically broken, but I don't want to go that far in PEP 558.
After sleeping on this, I'm now convinced that you're right, and we can reasonably drop the "stash extra info in the frame locals snapshot" feature from the *new* optimised frame locals C API. What I realised is that even if we don't offer that feature on the new frame locals proxy type, the *old* C API can still support it, unless & until that API is deprecated, as PyEval_GetLocals() bypasses the new API and accesses the frame state directly. Cheers, Nick.