From 9f75bbaf9045e232bce9ad5054d9c2ed7d166e1e Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 15 Jan 2024 13:45:52 +0200 Subject: [PATCH] Use lru_cache for Python 3.8 compatibilty --- src/PIL/ImageMath.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PIL/ImageMath.py b/src/PIL/ImageMath.py index 39a86cb11..8b56be51f 100644 --- a/src/PIL/ImageMath.py +++ b/src/PIL/ImageMath.py @@ -17,7 +17,7 @@ from __future__ import annotations import builtins -from functools import cache +from functools import lru_cache from types import CodeType from typing import Any @@ -225,7 +225,7 @@ def imagemath_convert(self: _Operand, mode: str) -> _Operand: return _Operand(self.im.convert(mode)) -@cache +@lru_cache def _get_ops() -> dict[str, Any]: return {k[10:]: v for k, v in globals().items() if k[:10] == "imagemath_"}