[docs] [issue26363] __builtins__ propagation is misleading described in exec and eval documentation

Xavier Combelle report at bugs.python.org
Tue Nov 29 19:27:39 EST 2016


Xavier Combelle added the comment:

It is not the dictionary of builtin module, which is inserted in , but the current __builtin__ global which happen to be normally the dictionnary of builtin. Hence in the following code, the builtins propagation works has expected.

>>> eval("""eval('spam("hello world")',{})""",{"__builtins__":{"eval":eval,"spam":print}})
hello world

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26363>
_______________________________________


More information about the docs mailing list