From 9606f7f0282e6e374df0e5b50d794877a052b35a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 27 Jun 2024 17:52:57 -0400 Subject: [PATCH] Fix build with Python 3.13 Python 3.13 has changed how `locals()` works [1], so this code needs to be a bit more explicit. [1] https://docs.python.org/3.13/whatsnew/3.13.html#defined-mutation-semantics-for-locals --- setup.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index b3bf0cee..2b86be3c 100644 --- a/setup.py +++ b/setup.py @@ -25,8 +25,12 @@ class RequiredDependencyException(Exception): def get_version(): """Returns version of the project.""" version_file = "pillow_heif/_version.py" - exec(compile(Path(version_file).read_text(encoding="utf-8"), version_file, "exec")) # pylint: disable=exec-used - return locals()["__version__"] + result = {} + exec( # pylint: disable=exec-used + compile(Path(version_file).read_text(encoding="utf-8"), version_file, "exec"), + result, + ) + return result["__version__"] def _cmd_exists(cmd: str) -> bool: