Hi Mark,
I've been working on a project heavily relying on frame.f_locals.
Are you planning to remove it?
No, PEP 558 doesn't remove it, it enhances it to be a live view of the frame state instead of an inconsistently updated snapshot.
The potential incompatibility Mark is referring to is the fact that even optimised frames currently allow writing to arbitrary keys in frame.f_locals and making the bound values visible to the locals() builtin and other consumers of frame.f_locals.
For PEP 558, it's an open question as to whether that behaviour will become limited to the PyEval_GetLocals() backwards compatible C API, with the updated Python frame API instead throwing KeyError for attempts to write to unknown keys on optimised frames.
Regards,
Nick.
On 30.01.21 13:18, Mark Shannon wrote:
>
> Given that f_locals is broken, why is keeping compatibility for this
> obscure, and probably unused case worthwhile?
>
> The break in compatibility with locals() seems much more intrusive,
> yet you are OK with that (as am I).
Best,
Sven