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

Xavier Combelle report at bugs.python.org
Thu Dec 1 07:22:49 EST 2016


Xavier Combelle added the comment:

Hi Julien,

You are fully right that it is the builtin module dictionnary which is inserted in eval or exec context.

However, if a "__builtins__" entry is passed to eval or exec, this builtin module dictionnary is modified hence the following work: 

>>> d={"tata":"tata"}
>>> print(eval("tata",{'__builtins__':d}))
tata

----------

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


More information about the docs mailing list