Lifetime of a local reference
Gregory Ewing
greg.ewing at canterbury.ac.nz
Thu Feb 28 00:23:54 EST 2019
Thomas Jollans wrote:
> If the inspect module's stack frame inspection machinery is supported,
> then any function call might access any local... (though I don't think a
> compliant Python implementation necessarily has to support the inspect
> module fully).
You can be devious even without using the expect module:
def fun():
f = open("lock.txt", "w")
do_stuff(innocent_argument)
do_stuff = exec
innocent_argument = "f.write('foo')"
--
Greg
More information about the Python-list
mailing list