https://github.com/python/cpython/commit/2b7b485c8d9385b91d15a93b8b7ef72ee7a95e0b commit: 2b7b485c8d9385b91d15a93b8b7ef72ee7a95e0b branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: JelleZijlstra <[email protected]> date: 2025-12-13T16:15:21Z summary:
[3.13] gh-142568: Fix eval() docs to use 'source' parameter name (GH-142644) (#142670) gh-142568: Fix eval() docs to use 'source' parameter name (GH-142644) (cherry picked from commit c865ab3781e92ccc56b1729b2b751ac2769f50a0) Co-authored-by: Joshua Ward <[email protected]> files: M Doc/library/functions.rst diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 04b5dc5bf8206e..d9ec50acf2208c 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -591,16 +591,16 @@ are always available. They are listed here in alphabetical order. This function executes arbitrary code. Calling it with user-supplied input may lead to security vulnerabilities. - The *expression* argument is parsed and evaluated as a Python expression + The *source* argument is parsed and evaluated as a Python expression (technically speaking, a condition list) using the *globals* and *locals* mappings as global and local namespace. If the *globals* dictionary is present and does not contain a value for the key ``__builtins__``, a reference to the dictionary of the built-in module :mod:`builtins` is - inserted under that key before *expression* is parsed. That way you can + inserted under that key before *source* is parsed. That way you can control what builtins are available to the executed code by inserting your own ``__builtins__`` dictionary into *globals* before passing it to :func:`eval`. If the *locals* mapping is omitted it defaults to the - *globals* dictionary. If both mappings are omitted, the expression is + *globals* dictionary. If both mappings are omitted, the source is executed with the *globals* and *locals* in the environment where :func:`eval` is called. Note, *eval()* will only have access to the :term:`nested scopes <nested scope>` (non-locals) in the enclosing _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
