![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
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 <report@bugs.python.org> <http://bugs.python.org/issue26363> _______________________________________