Skip to content

Commit

Permalink
DOC: Make warning on query/eval consistent (#60628)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhshadrach authored Dec 30, 2024
1 parent 2c7c6d6 commit b6fb6e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pandas/core/computation/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ def eval(
.. warning::
``eval`` can run arbitrary code which can make you vulnerable to code
injection and untrusted data.
This function can run arbitrary code which can make you vulnerable to code
injection if you pass user input to this function.
Parameters
----------
Expand Down
11 changes: 9 additions & 2 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4476,8 +4476,10 @@ def query(self, expr: str, *, inplace: bool = False, **kwargs) -> DataFrame | No
"""
Query the columns of a DataFrame with a boolean expression.
This method can run arbitrary code which can make you vulnerable to code
injection if you pass user input to this function.
.. warning::
This method can run arbitrary code which can make you vulnerable to code
injection if you pass user input to this function.
Parameters
----------
Expand Down Expand Up @@ -4634,6 +4636,11 @@ def eval(self, expr: str, *, inplace: bool = False, **kwargs) -> Any | None:
"""
Evaluate a string describing operations on DataFrame columns.
.. warning::
This method can run arbitrary code which can make you vulnerable to code
injection if you pass user input to this function.
Operates on columns only, not specific rows or elements. This allows
`eval` to run arbitrary code, which can make you vulnerable to code
injection if you pass user input to this function.
Expand Down

0 comments on commit b6fb6e7

Please sign in to comment.