Control: tags 1140944 + patch
Control: tags 1140944 + pending

Dear maintainer,

I've prepared an NMU for crmsh (versioned as 5.0.0-3.1) and uploaded
it to DELAYED/1. Please feel free to tell me if I should cancel it.

cu
Adrian
diffstat for crmsh-5.0.0 crmsh-5.0.0

 changelog                                                               |    7 +
 patches/0001-minieval.py-remove-ast.Num-and-ast.Str-no-longer-ava.patch |   44 ++++++++++
 patches/0002-Fix-fix-asyncio-usage-with-python-3.14-and-later.patch     |   33 +++++++
 patches/series                                                          |    2 
 4 files changed, 86 insertions(+)

diff -Nru crmsh-5.0.0/debian/changelog crmsh-5.0.0/debian/changelog
--- crmsh-5.0.0/debian/changelog	2026-02-26 22:25:38.000000000 +0200
+++ crmsh-5.0.0/debian/changelog	2026-07-05 19:39:35.000000000 +0300
@@ -1,3 +1,10 @@
+crmsh (5.0.0-3.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Backport upstream fixes for Python 3.14. (Closes: #1140944)
+
+ -- Adrian Bunk <[email protected]>  Sun, 05 Jul 2026 19:39:35 +0300
+
 crmsh (5.0.0-3) unstable; urgency=medium
 
   * d/rules: fix build source after successful build (Closes: #1044302)
diff -Nru crmsh-5.0.0/debian/patches/0001-minieval.py-remove-ast.Num-and-ast.Str-no-longer-ava.patch crmsh-5.0.0/debian/patches/0001-minieval.py-remove-ast.Num-and-ast.Str-no-longer-ava.patch
--- crmsh-5.0.0/debian/patches/0001-minieval.py-remove-ast.Num-and-ast.Str-no-longer-ava.patch	1970-01-01 02:00:00.000000000 +0200
+++ crmsh-5.0.0/debian/patches/0001-minieval.py-remove-ast.Num-and-ast.Str-no-longer-ava.patch	2026-07-05 19:39:35.000000000 +0300
@@ -0,0 +1,44 @@
+From 9175b0b8c87d52ac7c4429113c8d9d462353014a Mon Sep 17 00:00:00 2001
+From: Hector CAO <[email protected]>
+Date: Mon, 9 Feb 2026 15:41:39 +0100
+Subject: minieval.py : remove ast.Num and ast.Str no longer available in
+ Python 3.14
+
+---
+ crmsh/minieval.py | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/crmsh/minieval.py b/crmsh/minieval.py
+index 06e780c2..af9cde04 100644
+--- a/crmsh/minieval.py
++++ b/crmsh/minieval.py
+@@ -183,8 +183,7 @@ class SimpleEval(object):  # pylint: disable=too-few-public-methods
+         self.names = names
+ 
+         self.nodes = {
+-            ast.Num: self._eval_num,
+-            ast.Str: self._eval_str,
++            ast.Constant: self._eval_constant,
+             ast.Name: self._eval_name,
+             ast.UnaryOp: self._eval_unaryop,
+             ast.BinOp: self._eval_binop,
+@@ -204,9 +203,13 @@ class SimpleEval(object):  # pylint: disable=too-few-public-methods
+         elif isinstance(self.names, dict) and "None" not in self.names:
+             self.names["None"] = None
+ 
+-        # py3.8 uses ast.Constant instead of ast.Num, ast.Str, ast.NameConstant
+-        if hasattr(ast, 'Constant'):
+-            self.nodes[ast.Constant] = self._eval_constant
++        # py3.14 completely dropped ast.Num and ast.Str
++        # in favor of ast.Constant that encodes different types of value
++        # See https://docs.python.org/3/whatsnew/3.14.html#id9
++        if hasattr(ast, 'Str'):
++            self.nodes[ast.Str] = self._eval_str
++        if hasattr(ast, 'Num'):
++            self.nodes[ast.Num] = self._eval_num
+ 
+     def evaluate(self, expr):
+         """ evaluate an expresssion, using the operators, functions and
+-- 
+2.47.3
+
diff -Nru crmsh-5.0.0/debian/patches/0002-Fix-fix-asyncio-usage-with-python-3.14-and-later.patch crmsh-5.0.0/debian/patches/0002-Fix-fix-asyncio-usage-with-python-3.14-and-later.patch
--- crmsh-5.0.0/debian/patches/0002-Fix-fix-asyncio-usage-with-python-3.14-and-later.patch	1970-01-01 02:00:00.000000000 +0200
+++ crmsh-5.0.0/debian/patches/0002-Fix-fix-asyncio-usage-with-python-3.14-and-later.patch	2026-07-05 19:39:35.000000000 +0300
@@ -0,0 +1,33 @@
+From 0f553dafdb3e130911ebb40f2cce3673354bf96c Mon Sep 17 00:00:00 2001
+From: Andreas Hasenack <[email protected]>
+Date: Thu, 26 Feb 2026 10:03:56 -0300
+Subject: Fix: fix asyncio usage with python 3.14 and later
+
+From the python 3.14 changes document[1]:
+
+> asyncio.get_event_loop() now raises a RuntimeError if there is no current
+> event loop, and no longer implicitly creates an event loop.
+
+Fixes: #2032
+
+1. https://docs.python.org/3/whatsnew/3.14.html#id10
+---
+ crmsh/utils.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/crmsh/utils.py b/crmsh/utils.py
+index e9b78b8f..2f163b27 100644
+--- a/crmsh/utils.py
++++ b/crmsh/utils.py
+@@ -2977,7 +2977,7 @@ def retry_with_timeout(callable, timeout_sec: float, interval_sec=1):
+             except Exception:
+                 pass
+             await asyncio.sleep(interval_sec)
+-    return asyncio.get_event_loop_policy().get_event_loop().run_until_complete(asyncio.wait_for(wrapper(), timeout_sec))
++    return asyncio.run(asyncio.wait_for(wrapper(), timeout_sec))
+ 
+ 
+ def fetch_cluster_node_list_from_node(init_node):
+-- 
+2.47.3
+
diff -Nru crmsh-5.0.0/debian/patches/series crmsh-5.0.0/debian/patches/series
--- crmsh-5.0.0/debian/patches/series	2025-06-19 22:08:39.000000000 +0300
+++ crmsh-5.0.0/debian/patches/series	2026-07-05 19:39:35.000000000 +0300
@@ -14,3 +14,5 @@
 0025-Fix_doc_build.patch
 0026-Fix_python_build.patch
 0027-Rename_sbd_config.patch
+0001-minieval.py-remove-ast.Num-and-ast.Str-no-longer-ava.patch
+0002-Fix-fix-asyncio-usage-with-python-3.14-and-later.patch

Reply via email to