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 berker.peksag@gmail.com

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 <berker.peksag@gmail.com>
@miss-islington
Copy link
Contributor Author

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

@miss-islington miss-islington merged commit f19579b into python:3.6 Aug 19, 2018
@miss-islington miss-islington deleted the backport-225b055-3.6 branch August 19, 2018 10:32
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