[docs] [issue22057] The doc say all globals are copied on eval(), but only __builtins__ is copied

Martin Panter report at bugs.python.org
Fri Dec 2 21:32:54 EST 2016


Martin Panter added the comment:

“the current mapping of '__builtins__' is copied into *globals* ”

That sounds like we insert each individual builtin name, i.e. globals.update(builtins_mapping). But my understanding is that it is the __builtins__ global variable that is affected:

globals["__builtins__"] = builtins_mapping

What about borrowing the wording from exec():

If the *globals* dictionary is present and lacks ‘__builtins__’, a reference to the current mapping of ‘__builtins__’ is inserted under that key . . .

See also Issue 26363, which also covers this problem.

----------
nosy: +martin.panter
stage: needs patch -> patch review
versions: +Python 3.6, Python 3.7 -Python 3.4

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


More information about the docs mailing list