msg223837 - (view) |
Author: Alon Mishne (amishne) * |
Date: 2014-07-24 13:59 |
According to the documentation of eval(): > If the globals dictionary is present and lacks '__builtins__', the current globals are copied into globals before expression is parsed. However in practice only the __builtins__ items are copied, see: http://hg.python.org/cpython/file/2.7/Python/bltinmodule.c#l655 See http://stackoverflow.com/q/24934908/242762 |
|
|
msg223971 - (view) |
Author: Raymond Hettinger (rhettinger) *  |
Date: 2014-07-25 17:08 |
Thanks for noticing this. Do you want to propose a patch? |
|
|
msg224112 - (view) |
Author: Alon Mishne (amishne) * |
Date: 2014-07-27 09:55 |
Patch for 2.7.8. The patch is just changing "globals are" to "mapping of ‘__builtins__’ is", and subsequent paragraph reformatting. |
|
|
msg224113 - (view) |
Author: Alon Mishne (amishne) * |
Date: 2014-07-27 09:57 |
Patch for 3.5.x The patch is just changing "globals are" to "mapping of ‘__builtins__’ is", and subsequent paragraph reformatting. Nearly identical to 2.7.8 patch. |
|
|
msg242083 - (view) |
Author: Antti Haapala (ztane) * |
Date: 2015-04-26 21:54 |
+1 for this patch, the current documentation states it very wrong. |
|
|
msg242105 - (view) |
Author: Raymond Hettinger (rhettinger) *  |
Date: 2015-04-27 07:41 |
The patch looks good (though it would have been easier to check the diff if the text had not be reflowed). I will apply it when I get a chance. Or if anyone else wants to grab it, go ahead. |
|
|
msg282262 - (view) |
Author: Martin Panter (martin.panter) *  |
Date: 2016-12-03 02:32 |
“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. |
|
|
msg323736 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2018-08-18 22:19 |
I like Martin's suggestion in and I've just created PR 8812 to implement it. |
|
|
msg323748 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2018-08-19 10:25 |
New changeset 225b05548027d55aafb11b65f6a4a2bef2f5196f by Berker Peksag in branch 'master': bpo-22057: Clarify eval() documentation (GH-8812) https://github.com/python/cpython/commit/225b05548027d55aafb11b65f6a4a2bef2f5196f |
|
|
msg323749 - (view) |
Author: miss-islington (miss-islington) |
Date: 2018-08-19 10:29 |
New changeset 0e1e8dbb0b99ec78f4567382428fdd46e2244d40 by Miss Islington (bot) in branch '3.7': bpo-22057: Clarify eval() documentation (GH-8812) https://github.com/python/cpython/commit/0e1e8dbb0b99ec78f4567382428fdd46e2244d40 |
|
|
msg323751 - (view) |
Author: miss-islington (miss-islington) |
Date: 2018-08-19 10:32 |
New changeset f19579b8f1fcd2dd8ffaf3e443b09930057c01d1 by Miss Islington (bot) in branch '3.6': bpo-22057: Clarify eval() documentation (GH-8812) https://github.com/python/cpython/commit/f19579b8f1fcd2dd8ffaf3e443b09930057c01d1 |
|
|
msg323752 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2018-08-19 10:53 |
Thanks for the review, Martin, and thanks for the report, Alon! |
|
|