Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[3.7] bpo-22057: Clarify eval() documentation (GH-8812) #8818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2018

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