From ed82f4d235eb6a739699e8485748204818393442 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 28 Jun 2025 10:57:23 +1000 Subject: [PATCH] Use unpacking --- src/PIL/ImageMath.py | 2 +- src/PIL/McIdasImagePlugin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PIL/ImageMath.py b/src/PIL/ImageMath.py index 484797f91..c33809ced 100644 --- a/src/PIL/ImageMath.py +++ b/src/PIL/ImageMath.py @@ -308,7 +308,7 @@ def unsafe_eval( # build execution namespace args: dict[str, Any] = ops.copy() - for k in list(options.keys()) + list(kw.keys()): + for k in [*options, *kw]: if "__" in k or hasattr(builtins, k): msg = f"'{k}' not allowed" raise ValueError(msg) diff --git a/src/PIL/McIdasImagePlugin.py b/src/PIL/McIdasImagePlugin.py index b4460a9a5..4c34dd7e5 100644 --- a/src/PIL/McIdasImagePlugin.py +++ b/src/PIL/McIdasImagePlugin.py @@ -44,7 +44,7 @@ class McIdasImageFile(ImageFile.ImageFile): raise SyntaxError(msg) self.area_descriptor_raw = s - self.area_descriptor = w = [0] + list(struct.unpack("!64i", s)) + self.area_descriptor = w = [0, *struct.unpack("!64i", s)] # get mode if w[11] == 1: