Skip to content

Commit f932cb8

Browse files
radarherehugovk
authored andcommitted
Added danger alerts
1 parent a7e82cb commit f932cb8

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

docs/reference/ImageMath.rst

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ Example: Using the :py:mod:`~PIL.ImageMath` module
4646

4747
.. py:function:: unsafe_eval(expression, environment)
4848
49-
Evaluates an image expression. This uses Python's ``eval()`` function to process
50-
the expression string, and carries the security risks of doing so. It is not
51-
recommended to process expressions without considering this.
52-
:py:meth:`~lambda_eval` is a more secure alternative.
49+
Evaluates an image expression.
50+
51+
.. danger::
52+
This uses Python's ``eval()`` function to process the expression string,
53+
and carries the security risks of doing so. It is not
54+
recommended to process expressions without considering this.
55+
:py:meth:`lambda_eval` is a more secure alternative.
5356

5457
:py:mod:`~PIL.ImageMath` only supports single-layer images. To process multi-band
5558
images, use the :py:meth:`~PIL.Image.Image.split` method or
@@ -69,14 +72,17 @@ Example: Using the :py:mod:`~PIL.ImageMath` module
6972
Expression syntax
7073
-----------------
7174

72-
:py:meth:`~lambda_eval` expressions are functions that receive a dictionary containing
73-
images and operators.
75+
* :py:meth:`lambda_eval` expressions are functions that receive a dictionary
76+
containing images and operators.
7477

75-
:py:meth:`~unsafe_eval` expressions are standard Python expressions, but they’re
76-
evaluated in a non-standard environment.
78+
* :py:meth:`unsafe_eval` expressions are standard Python expressions,
79+
but they’re evaluated in a non-standard environment.
7780

78-
In both cases, you can use Pillow methods as usual, plus the following set of operators
79-
and functions.
81+
.. danger::
82+
:py:meth:`unsafe_eval` uses Python's ``eval()`` function to process the
83+
expression string, and carries the security risks of doing so.
84+
It is not recommended to process expressions without considering this.
85+
:py:meth:`lambda_eval` is a more secure alternative.
8086

8187
Standard Operators
8288
^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)