| 1 |
From: Sam James <[email protected]> |
| 2 |
Date: Sat, 31 May 2025 18:54:51 +0100 |
| 3 |
Subject: Menu: handle Python 3.15 deprecations |
| 4 |
|
| 5 |
* Unknown keyword args will be fatal, so drop lineno/col_offset that |
| 6 |
is unused |
| 7 |
* Set body= immediately as a keyword |
| 8 |
--- |
| 9 |
xdg/Menu.py | 5 +---- |
| 10 |
1 file changed, 1 insertion(+), 4 deletions(-) |
| 11 |
|
| 12 |
diff --git a/xdg/Menu.py b/xdg/Menu.py |
| 13 |
index 3d4f3b8..b5d01f0 100644 |
| 14 |
--- a/xdg/Menu.py |
| 15 |
+++ b/xdg/Menu.py |
| 16 |
@@ -419,7 +419,6 @@ class Rule: |
| 17 |
ctx=ast.Load() |
| 18 |
)] |
| 19 |
), |
| 20 |
- lineno=1, col_offset=0 |
| 21 |
) |
| 22 |
ast.fix_missing_locations(tree) |
| 23 |
rule = Rule(type, tree) |
| 24 |
@@ -772,12 +771,10 @@ class XMLMenuBuilder(object): |
| 25 |
|
| 26 |
def parse_rule(self, node): |
| 27 |
type = Rule.TYPE_INCLUDE if node.tag == 'Include' else Rule.TYPE_EXCLUDE |
| 28 |
- tree = ast.Expression(lineno=1, col_offset=0) |
| 29 |
+ tree = ast.Expression(body=_ast_const('False')) |
| 30 |
expr = self.parse_bool_op(node, ast.Or()) |
| 31 |
if expr: |
| 32 |
tree.body = expr |
| 33 |
- else: |
| 34 |
- tree.body = _ast_const('False') |
| 35 |
ast.fix_missing_locations(tree) |
| 36 |
return Rule(type, tree) |
| 37 |
|