Skip to content

Commit

Permalink
Merge pull request #160 from danthedeckie/3.14-fixes
Browse files Browse the repository at this point in the history
3.14 (prerelease) fixes
  • Loading branch information
danthedeckie authored Nov 2, 2024
2 parents d65091a + 7bf2739 commit b16cc40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- '3.11'
- '3.12'
- '3.13'
- '3.14'
- 'pypy-3.9'
- 'pypy-3.10'
env:
Expand Down
6 changes: 3 additions & 3 deletions simpleeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit b16cc40

Please sign in to comment.