Skip to content

Conversation

@MikeSiLVO
Copy link

@MikeSiLVO MikeSiLVO commented Nov 25, 2025

Description

Updated from upstream to v1.0.3

Checklist:

  • My code follows the add-on rules and piracy stance of this project.
  • I have read the CONTRIBUTING document
  • Each add-on submission should be a single commit with using the following style: [script.foo.bar] 1.0.0

Additional information :

  • Submitting your add-on to this specific branch makes it available to any Kodi version equal or higher than the branch name with the applicable Kodi dependencies limits.
  • add-on development wiki page.
  • Kodi pydocs provide information about the Python API
  • PEP8 codingstyle which is considered best practise but not mandatory.
  • This add-on repository has automated code guideline check which could help you improve your coding. You can find the results of these check at Codacy. You can create your own account as well to continuously monitor your python coding before submitting to repo.
  • Development questions can be asked in the add-on development section on the Kodi forum.

@rysson
Copy link

rysson commented Dec 23, 2025

Hi, I suggest tiny patch to allow work simpleeval 0.9.13 with py3.14 (ast.Num and ast.Str are removed in py3.14).
This version needs at least py3.8 (:= is used).

diff --git a/script.module.simpleeval/lib/simpleeval.py b/script.module.simpleeval/lib/simpleeval.py
index f6a3ed6ef..f53081364 100644
--- a/script.module.simpleeval/lib/simpleeval.py
+++ b/script.module.simpleeval/lib/simpleeval.py
@@ -359,8 +359,8 @@ class SimpleEval(object):  # pylint: disable=too-few-public-methods
             ast.Assign: self._eval_assign,
             ast.AugAssign: self._eval_aug_assign,
             ast.Import: self._eval_import,
-            ast.Num: self._eval_num,
-            ast.Str: self._eval_str,
+            # ast.Num: self._eval_num,  # removed in py3.14
+            # ast.Str: self._eval_str,  # removed in py3.14
             ast.Name: self._eval_name,
             ast.UnaryOp: self._eval_unaryop,
             ast.BinOp: self._eval_binop,
@@ -375,9 +375,19 @@ class SimpleEval(object):  # pylint: disable=too-few-public-methods
             ast.Slice: self._eval_slice,
         }
 
-        # py3k stuff:
-        if hasattr(ast, "NameConstant"):
-            self.nodes[ast.NameConstant] = self._eval_constant
+        # taken from simpleeval 1.0.3 (support for py3.14)
+        with warnings.catch_warnings():
+            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", None):
+                self.nodes[Num] = self._eval_num
+
+            if Str := getattr(ast, "Str", None):
+                self.nodes[Str] = self._eval_str
+
+            if NameConstant := getattr(ast, "NameConstant", None):
+                self.nodes[NameConstant] = self._eval_constant
 
         # py3.6, f-strings
         if hasattr(ast, "JoinedStr"):

@rysson
Copy link

rysson commented Dec 29, 2025

@MikeSiLVO I've checked. simpleeval 1.0.3 works with python 3.8 too¹, than I suggest just upgrade the simpleeval (without any extra patches)

¹) I know, pip3.8 installs simpleeval 0.9.3

@MikeSiLVO MikeSiLVO changed the title [script.module.simpleeval] 0.9.13 [script.module.simpleeval] 1.0.3 Dec 30, 2025
@pkscout pkscout merged commit e4d56ac into xbmc:matrix Dec 31, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants