]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-22057: Clarify eval() documentation (GH-8812)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 19 Aug 2018 10:29:50 +0000 (06:29 -0400)
committerGitHub <noreply@github.com>
Sun, 19 Aug 2018 10:29:50 +0000 (06:29 -0400)
commit0e1e8dbb0b99ec78f4567382428fdd46e2244d40
tree8cb1ba7b66785a29fba7d174410b5026980f9dd3
parent2e4ae8f1b3147d7f0a461b4ffdde9bcc9e6a2083
bpo-22057: Clarify eval() documentation (GH-8812)

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 225b05548027d55aafb11b65f6a4a2bef2f5196f)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
Doc/library/functions.rst