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

2018-08-18 Thread Berker Peksag
Berker Peksag added the comment: Thank you for the report, Xavier. This is a duplicate of issue 22057. PR 8812 clarifies the behavior when a dictionary without a "__builtins__" key is passed as *globals* to eval(). I think that makes the opposite case much easier to understand. >>>

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

2016-12-02 Thread Martin Panter
Martin Panter added the comment: Xavier, you are welcome to propose your own version of the text, or build on Julien’s. See also Issue 22057, about copying all globals vs builtins. -- nosy: +martin.panter stage: -> patch review versions: +Python 2.7, Python 3.6, Python 3.7

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

2016-12-01 Thread Xavier Combelle
Xavier Combelle added the comment: not an inconsisties but in the eval documentaion nothing specify that the builtins propagate between levels updates -- ___ Python tracker

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

2016-12-01 Thread Julien Palard
Julien Palard added the comment: So, is there still an inconsistency in the documentation? -- ___ Python tracker ___

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

2016-12-01 Thread Xavier Combelle
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: >>>

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

2016-11-30 Thread Eryk Sun
Eryk Sun added the comment: As shown above, exec and eval default to calling PyEval_GetBuiltins when the globals dict doesn't define '__builtins__'. PyEval_GetBuiltins uses the current frame's f_builtins. If there isn't a current frame, it defaults to the interpreter's builtins, which should

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

2016-11-30 Thread Julien Palard
Julien Palard added the comment: Hi Xavier, > It is not the dictionary of builtin module, which is inserted in , but the > current __builtin__ global It looks wrong, I'll even say the exact contrary: It _is_ the dictionary of builtin module which is inserted in, not the current __builtin__

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

2016-11-29 Thread Xavier Combelle
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. >>>

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

2016-11-26 Thread Julien Palard
Julien Palard added the comment: Hi Xavier, thanks for reporting, Your first point is right, the implementation being: if (PyDict_GetItemString(globals, "__builtins__") == NULL) { if (PyDict_SetItemString(globals, "__builtins__", PyEval_GetBuiltins()) != 0)

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

2016-02-15 Thread Julien
Changes by Julien : -- nosy: +sizeof ___ Python tracker ___ ___ Python-bugs-list mailing

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

2016-02-15 Thread Xavier Combelle
New submission from Xavier Combelle: According to my experiment in code, the current behavior of python3.5 is different that the document says. If I understand well the purpose of this behavior is to propagate the __builtins__ global constant if globals has not one. In