From 62c2be0673a76fc329325fa070e9f270a66a0bae Mon Sep 17 00:00:00 2001 From: Jerry James Date: Fri, 22 Mar 2024 10:51:57 -0600 Subject: [PATCH] Fix test failure with python 3.13 (rhbz#2271058) --- sympy-python3.12.patch | 52 ++++++++++++++++++++++++------------------ sympy.spec | 4 +++- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/sympy-python3.12.patch b/sympy-python3.12.patch index 5c4a874..2458bc0 100644 --- a/sympy-python3.12.patch +++ b/sympy-python3.12.patch @@ -30,7 +30,7 @@ def visit_Lambda(self, node): args = [self.visit(arg) for arg in node.args.args] --- sympy-sympy-1.12/sympy/parsing/sympy_parser.py.orig 2023-05-09 17:42:05.000000000 -0600 -+++ sympy-sympy-1.12/sympy/parsing/sympy_parser.py 2023-06-29 17:42:24.574014070 -0600 ++++ sympy-sympy-1.12/sympy/parsing/sympy_parser.py 2024-03-22 10:22:05.814313289 -0600 @@ -627,7 +627,9 @@ def factorial_notation(tokens: List[TOKE result: List[TOKEN] = [] nfactorial = 0 @@ -42,62 +42,70 @@ op = tokval if op == '!': nfactorial += 1 -@@ -1135,7 +1137,7 @@ class EvaluateFalseTransformer(ast.NodeT +@@ -1135,9 +1137,7 @@ class EvaluateFalseTransformer(ast.NodeT new_node = ast.Call( func=ast.Name(id=sympy_class, ctx=ast.Load()), args=[left, right], - keywords=[ast.keyword(arg='evaluate', value=ast.NameConstant(value=False, ctx=ast.Load()))], -+ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], - starargs=None, - kwargs=None +- starargs=None, +- kwargs=None ++ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False))] ) -@@ -1167,8 +1169,8 @@ class EvaluateFalseTransformer(ast.NodeT + return new_node + return node +@@ -1167,10 +1167,8 @@ class EvaluateFalseTransformer(ast.NodeT if isinstance(node.op, ast.Sub): right = ast.Call( func=ast.Name(id='Mul', ctx=ast.Load()), - args=[ast.UnaryOp(op=ast.USub(), operand=ast.Num(1)), right], - keywords=[ast.keyword(arg='evaluate', value=ast.NameConstant(value=False, ctx=ast.Load()))], +- starargs=None, +- kwargs=None + args=[ast.UnaryOp(op=ast.USub(), operand=ast.Constant(1)), right], -+ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], - starargs=None, - kwargs=None ++ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False))] ) -@@ -1178,16 +1180,16 @@ class EvaluateFalseTransformer(ast.NodeT + elif isinstance(node.op, ast.Div): + if isinstance(node.left, ast.UnaryOp): +@@ -1178,18 +1176,14 @@ class EvaluateFalseTransformer(ast.NodeT rev = True left = ast.Call( func=ast.Name(id='Pow', ctx=ast.Load()), - args=[left, ast.UnaryOp(op=ast.USub(), operand=ast.Num(1))], - keywords=[ast.keyword(arg='evaluate', value=ast.NameConstant(value=False, ctx=ast.Load()))], +- starargs=None, +- kwargs=None + args=[left, ast.UnaryOp(op=ast.USub(), operand=ast.Constant(1))], -+ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], - starargs=None, - kwargs=None ++ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False))] ) else: right = ast.Call( func=ast.Name(id='Pow', ctx=ast.Load()), - args=[right, ast.UnaryOp(op=ast.USub(), operand=ast.Num(1))], - keywords=[ast.keyword(arg='evaluate', value=ast.NameConstant(value=False, ctx=ast.Load()))], +- starargs=None, +- kwargs=None + args=[right, ast.UnaryOp(op=ast.USub(), operand=ast.Constant(1))], -+ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], - starargs=None, - kwargs=None ++ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False))] ) -@@ -1197,7 +1199,7 @@ class EvaluateFalseTransformer(ast.NodeT + + if rev: # undo reversal +@@ -1197,9 +1191,7 @@ class EvaluateFalseTransformer(ast.NodeT new_node = ast.Call( func=ast.Name(id=sympy_class, ctx=ast.Load()), args=[left, right], - keywords=[ast.keyword(arg='evaluate', value=ast.NameConstant(value=False, ctx=ast.Load()))], -+ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], - starargs=None, - kwargs=None +- starargs=None, +- kwargs=None ++ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False))] ) -@@ -1212,7 +1214,7 @@ class EvaluateFalseTransformer(ast.NodeT + + if sympy_class in ('Add', 'Mul'): +@@ -1212,7 +1204,7 @@ class EvaluateFalseTransformer(ast.NodeT def visit_Call(self, node): new_node = self.generic_visit(node) if isinstance(node.func, ast.Name) and node.func.id in self.functions: - new_node.keywords.append(ast.keyword(arg='evaluate', value=ast.NameConstant(value=False, ctx=ast.Load()))) -+ new_node.keywords.append(ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))) ++ new_node.keywords.append(ast.keyword(arg='evaluate', value=ast.Constant(value=False))) return new_node diff --git a/sympy.spec b/sympy.spec index c34d739..392a7a3 100644 --- a/sympy.spec +++ b/sympy.spec @@ -14,10 +14,12 @@ Summary: A Python library for symbolic mathematics # The files in sympy/parsing/latex are MIT. License: BSD-3-Clause AND MIT URL: https://sympy.org/ -Source0: https://github.com/%{name}/%{name}/archive/%{name}-%{version}.tar.gz +VCS: https://github.com/sympy/sympy +Source0: %{vcs}/archive/%{name}-%{version}.tar.gz # Skip tests that require a display Patch0: %{name}-circuitplot.patch # Adapt to python 3.12 +# https://github.com/sympy/sympy/pull/26386 Patch1: %{name}-python3.12.patch # Fix incompatible pointers, which are an error with GCC 14 # https://github.com/sympy/sympy/pull/25968