From 7ec186edd5b6accfd9c33ece455987c8ad5cf2d7 Mon Sep 17 00:00:00 2001 From: Joshua-Ward1 Date: Fri, 12 Dec 2025 15:05:08 -0500 Subject: [PATCH] gh-142568: Fix eval() docs to use 'source' parameter name --- Doc/library/functions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst index 601745a75780fc..9cfbb5a482e974 100644 --- a/Doc/library/functions.rst +++ b/Doc/library/functions.rst @@ -606,16 +606,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 ` (non-locals) in the enclosing