[docs] [issue19431] Document PyFrame_FastToLocals() and PyFrame_FastToLocalsWithError()
João Sebastião de Oliveira Bueno
report at bugs.python.org
Fri Jan 12 09:09:49 EST 2018
João Sebastião de Oliveira Bueno <gwidion at gmail.com> added the comment:
This discussion is fresh, so maybe it is worth asking here prior to python-ideas:
In Python we can change any global variable, object attribute or mapping-value with function calls. Locals and nonlocals are the only exceptions and from time to time that gets in the way of clever oneliners, and it is just plain asymmetric.
What do you say of adding a wrapper to this as an oficial Python function in the stdlib? Maybe inspect.setlocal() that could set f_locals and call this?? That would provide a workaround to the asymmetry that locals currently experiment.
It would not impose any extra security risks, since this can be called via ctypes already, and also it is not any more subject to abuse than setattr or globals()[...] = can already be abused.
Python tracker <report at bugs.python.org>
More information about the docs