Skip to content

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Aug 19, 2018

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 [email protected]

https://bugs.python.org/issue22057

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 <[email protected]>
@miss-islington
Copy link
Contributor Author

@berkerpeksag: Backport status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 0e1e8db into python:3.7 Aug 19, 2018
@miss-islington miss-islington deleted the backport-225b055-3.7 branch August 19, 2018 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants