8000 [3.13] gh-118633: Add warning regarding the unsafe usage of eval and … · python/cpython@343a7a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 343a7a6

Browse files
miss-islingtonDanielRufEclips4JelleZijlstra
authored
[3.13] gh-118633: Add warning regarding the unsafe usage of eval and exec (GH-118437) (#126161)
gh-118633: Add warning regarding the unsafe usage of eval and exec (GH-118437) * Add warning regarding the unsafe usage of eval * Add warning regarding the unsafe usage of exec * Move warning under parameters table * Use suggested shorter text * Use suggested shorter text * Improve wording as suggested --------- (cherry picked from commit 00e5ec0) Co-authored-by: Daniel Ruf <daniel@daniel-ruf.de> Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
1 parent b9cbc58 commit 343a7a6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Doc/library/functions.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,11 @@ are always available. They are listed here in alphabetical order.
588588
:returns: The result of the evaluated expression.
589589
:raises: Syntax errors are reported as exceptions.
590590

591+
.. warning::
592+
593+
This function executes arbitrary code. Calling it with
594+
user-supplied input may lead to security vulnerabilities.
595+
591596
The *expression* argument is parsed and evaluated as a Python expression
592597
(technically speaking, a condition list) using the *globals* and *locals*
593598
mappings as global and local namespace. If the *globals* dictionary is
@@ -644,6 +649,11 @@ are always available. They are listed here in alphabetical order.
644649

645650
.. function:: exec(source, /, globals=None, locals=None, *, closure=None)
646651

652+
.. warning::
653+
654+
This function executes arbitrary code. Calling it with
655+
user-supplied input may lead to security vulnerabilities.
656+
647657
This function supports dynamic execution of Python code. *source* must be
648658
either a string or a code object. If it is a string, the string is parsed as
649659
a suite of Python statements which is then executed (unless a syntax error

0 commit comments

Comments
 (0)
0