Skip to content

Commit f5eeeac

Browse files
committed
Name as 'options' in lambda_eval and unsafe_eval, but '_dict' in deprecated eval
1 parent 8f3860c commit f5eeeac

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/PIL/ImageMath.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def imagemath_convert(self: _Operand, mode: str) -> _Operand:
238238

239239
def lambda_eval(
240240
expression: Callable[[dict[str, Any]], Any],
241-
_dict: dict[str, Any] = {},
241+
options: dict[str, Any] = {},
242242
**kw: Any,
243243
) -> Any:
244244
"""
@@ -258,7 +258,7 @@ def lambda_eval(
258258
"""
259259

260260
args: dict[str, Any] = ops.copy()
261-
args.update(_dict)
261+
args.update(options)
262262
args.update(kw)
263263
for k, v in args.items():
264264
if hasattr(v, "im"):
@@ -273,7 +273,7 @@ def lambda_eval(
273273

274274
def unsafe_eval(
275275
expression: str,
276-
_dict: dict[str, Any] = {},
276+
options: dict[str, Any] = {},
277277
**kw: Any,
278278
) -> Any:
279279
"""
@@ -297,12 +297,12 @@ def unsafe_eval(
297297

298298
# build execution namespace
299299
args: dict[str, Any] = ops.copy()
300-
for k in list(_dict.keys()) + list(kw.keys()):
300+
for k in list(options.keys()) + list(kw.keys()):
301301
if "__" in k or hasattr(builtins, k):
302302
msg = f"'{k}' not allowed"
303303
raise ValueError(msg)
304304

305-
args.update(_dict)
305+
args.update(options)
306306
args.update(kw)
307307
for k, v in args.items():
308308
if hasattr(v, "im"):
@@ -339,9 +339,9 @@ def eval(
339339
Deprecated. Use lambda_eval() or unsafe_eval() instead.
340340
341341
:param expression: A string containing a Python-style expression.
342-
:param options: Values to add to the evaluation context. You
343-
can either use a dictionary, or one or more keyword
344-
arguments.
342+
:param _dict: Values to add to the evaluation context. You
343+
can either use a dictionary, or one or more keyword
344+
arguments.
345345
:return: The evaluated expression. This is usually an image object, but can
346346
also be an integer, a floating point value, or a pixel tuple,
347347
depending on the expression.

0 commit comments

Comments
 (0)