Merge ~hectorcao/ubuntu/+source/crmsh:lp2139102 into ubuntu/+source/crmsh:ubuntu/devel

Proposed by Hector CAO
Status: Merged
Merged at revision: f8f1bb5a2a2199a7fe4908adbc900f5d3c3f8f4f
Proposed branch: ~hectorcao/ubuntu/+source/crmsh:lp2139102
Merge into: ubuntu/+source/crmsh:ubuntu/devel
Diff against target: 78 lines (+56/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/0028-minieval.py-Use-ast.Constant-instead-of-ast.Num.patch (+48/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Christian Ehrhardt (community) Approve
git-ubuntu import Pending
Review via email: mp+499662@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Christian Ehrhardt (paelzer) wrote :

- please report upstream and refer to it in dep3 headers

- please fix this for Str and Num, use the pattern they already established for Constant when handling potentially existing elements

Something like

Remove the two lines about Num and Str

# py3.14 completely dropped ast.Num and ast.Str - https://docs.python.org/3/whatsnew/3.14.html#id9
        if hasattr(ast, 'Num'):
            self.nodes[ast.Num] = self._eval_num
        if hasattr(ast, 'Str'):
            self.nodes[ast.Str] = self._eval_str

- commit message "changelog" could be nicer, maybe "changelog for 5.0.0-2ubuntu2"

review: Needs Fixing
Revision history for this message
Hector CAO (hectorcao) wrote :

Thanks Christian for the review,

- I reported the bug upstream + MR
- I refreshed the Ubuntu patch based on the MR upstream
- I improved the changelog commit message

Please let me know what you think,

Revision history for this message
Christian Ehrhardt (paelzer) wrote :

Thanks for the changes, approved and uploading

review: Approve
Revision history for this message
Christian Ehrhardt (paelzer) wrote :

Uploading crmsh_5.0.0-2ubuntu2.dsc
Uploading crmsh_5.0.0-2ubuntu2.debian.tar.xz
Uploading crmsh_5.0.0-2ubuntu2_source.buildinfo
Uploading crmsh_5.0.0-2ubuntu2_source.changes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 4dc8bf9..a933d9e 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+crmsh (5.0.0-2ubuntu2) resolute; urgency=medium
7+
8+ * d/p/0028-* : Replace ast.Num by ast.Constant for Python 3.14
9+ (LP: #2139102)
10+
11+ -- Hector Cao <hector.cao@canonical.com> Mon, 02 Feb 2026 16:57:08 +0100
12+
13 crmsh (5.0.0-2ubuntu1) resolute; urgency=medium
14
15 * Merge with Debian unstable (LP: #2125991). Remaining changes:
16diff --git a/debian/patches/0028-minieval.py-Use-ast.Constant-instead-of-ast.Num.patch b/debian/patches/0028-minieval.py-Use-ast.Constant-instead-of-ast.Num.patch
17new file mode 100644
18index 0000000..c0b666b
19--- /dev/null
20+++ b/debian/patches/0028-minieval.py-Use-ast.Constant-instead-of-ast.Num.patch
21@@ -0,0 +1,48 @@
22+Description: minieval.py : remove ast.Num and ast.Str
23+
24+ Python 3.14 now removes ast.Num and ast.Str in favor
25+ of ast.Constant.
26+
27+Forwarded: https://github.com/ClusterLabs/crmsh/pull/2028
28+Author: Hector CAO <hector.cao@canonical.com>
29+Bug-Ubuntu: https://bugs.launchpad.net/bugs/2139102
30+Last-Update: 2026-02-09
31+
32+---
33+ crmsh/minieval.py | 13 ++++++++-----
34+ 1 file changed, 8 insertions(+), 5 deletions(-)
35+
36+diff --git a/crmsh/minieval.py b/crmsh/minieval.py
37+index 06e780c2..af9cde04 100644
38+--- a/crmsh/minieval.py
39++++ b/crmsh/minieval.py
40+@@ -183,8 +183,7 @@ class SimpleEval(object): # pylint: disable=too-few-public-methods
41+ self.names = names
42+
43+ self.nodes = {
44+- ast.Num: self._eval_num,
45+- ast.Str: self._eval_str,
46++ ast.Constant: self._eval_constant,
47+ ast.Name: self._eval_name,
48+ ast.UnaryOp: self._eval_unaryop,
49+ ast.BinOp: self._eval_binop,
50+@@ -204,9 +203,13 @@ class SimpleEval(object): # pylint: disable=too-few-public-methods
51+ elif isinstance(self.names, dict) and "None" not in self.names:
52+ self.names["None"] = None
53+
54+- # py3.8 uses ast.Constant instead of ast.Num, ast.Str, ast.NameConstant
55+- if hasattr(ast, 'Constant'):
56+- self.nodes[ast.Constant] = self._eval_constant
57++ # py3.14 completely dropped ast.Num and ast.Str
58++ # in favor of ast.Constant that encodes different types of value
59++ # See https://docs.python.org/3/whatsnew/3.14.html#id9
60++ if hasattr(ast, 'Str'):
61++ self.nodes[ast.Str] = self._eval_str
62++ if hasattr(ast, 'Num'):
63++ self.nodes[ast.Num] = self._eval_num
64+
65+ def evaluate(self, expr):
66+ """ evaluate an expresssion, using the operators, functions and
67+--
68+2.34.1
69+
70diff --git a/debian/patches/series b/debian/patches/series
71index 74a5afc..8782319 100644
72--- a/debian/patches/series
73+++ b/debian/patches/series
74@@ -14,3 +14,4 @@
75 0025-Fix_doc_build.patch
76 0026-Fix_python_build.patch
77 0027-Rename_sbd_config.patch
78+0028-minieval.py-Use-ast.Constant-instead-of-ast.Num.patch

Subscribers

People subscribed via source and target branches