When __builtins__
is set and I try to access function globals, I get this error
>>> def f(): pass
...
>>> f.func_globals
{'f': <function f at 0x00B83270>, '__builtins__': <module '__builtin__' (built-in)>}
>>> __builtins__ = {}
>>> f.func_globals
Traceback (most recent call last):
File "<string>", line 1, in <string>
RuntimeError: restricted attribute
>>>
Why is that, where I can read more about it? Can I use it to safeguard expression evaluation?
See Question: http://stackoverflow.com/questions/1994071/how-safe-is-expression-evaluation-using-eval