[3.6] bpo-22057: Clarify eval() documentation (GH-8812) by miss-islington · Pull Request #8819 · python/cpython (original) (raw)

If a globals dictionary without a 'builtins' key is passed to
eval(), a 'builtins' key will be inserted to the dictionary:

>>> eval("print('__builtins__' in globals())", {})
True

(As a result of this behavior, we can use the builtins
print() and globals() even if we passed a dictionary without a
'builtins' key to eval().)
(cherry picked from commit 225b055)

Co-authored-by: Berker Peksag berker.peksag@gmail.com

https://bugs.python.org/issue22057