From 44da3236621dee35c43aecf7cce4347be00147ee Mon Sep 17 00:00:00 2001 From: Daniel Fairhead Date: Sat, 2 Nov 2024 10:18:02 +0000 Subject: [PATCH 1/2] fix getattr for ast deprecated bits in 3.14 --- simpleeval.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/simpleeval.py b/simpleeval.py index 60b7fef..885a760 100644 --- a/simpleeval.py +++ b/simpleeval.py @@ -386,13 +386,13 @@ def __init__(self, operators=None, functions=None, names=None): warnings.simplefilter("ignore") # py3.12 deprecated ast.Num, ast.Str, ast.NameConstant # https://docs.python.org/3.12/whatsnew/3.12.html#deprecated - if Num := getattr(ast, "Num"): + if Num := getattr(ast, "Num", None): self.nodes[Num] = self._eval_num - if Str := getattr(ast, "Str"): + if Str := getattr(ast, "Str", None): self.nodes[Str] = self._eval_str - if NameConstant := getattr(ast, "NameConstant"): + if NameConstant := getattr(ast, "NameConstant", None): self.nodes[NameConstant] = self._eval_constant # Defaults: From 7bf273938f1c0d0734e58e5a36d013ebaef83751 Mon Sep 17 00:00:00 2001 From: Daniel Fairhead Date: Sat, 2 Nov 2024 10:21:42 +0000 Subject: [PATCH 2/2] Add 3.14 prerelease to GH --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ae50324..9c8d03f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,7 @@ jobs: - '3.11' - '3.12' - '3.13' + - '3.14' - 'pypy-3.9' - 'pypy-3.10' env: