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)
return NULL;
}
See proposed diff.
For the second point, it looks right to me in the documentation, literally: "A
reference to the dictionary of the builtin module builtins is inserted", so:
It's a dict:
>>> exec('print(type(globals()["__builtins__"]))', {})
<class 'dict'>
It's the reference to the dict of the builtins module:
>>> exec('globals()["__builtins__"]["len"] = "foo"', {})
>>> len
'foo'
If you still think there's inconsistencies, please provide some code to
reproduce it.
----------
keywords: +patch
Added file: http://bugs.python.org/file45652/issue26363.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue26363>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com