On Wed, Dec 3, 2014 at 5:28 AM, Gregory Ewing <greg.ew...@canterbury.ac.nz> wrote: > > Kasper Peeters wrote: >> >> That may have been the design plan, but in Python 2.7.6, I definitely >> am able to inject locals via PyEval_GetLocals() and have them be visible >> both from the C and Python side; > > What seems to be happening is that the dict created by > PyEval_GetLocals() is kept around, so you can change it > and have the changes be visible through locals() in > Python.
That the dict is cached is an implementation detail. It's not advisable to rely upon this, and as stated in the Python docs, the locals dict should not be modified.
-- https://mail.python.org/mailman/listinfo/python-list