Fix test failure with python 3.13 (rhbz#2271058)

This commit is contained in:
Jerry James 2024-03-22 10:51:57 -06:00
parent a5e2642668
commit 62c2be0673
2 changed files with 33 additions and 23 deletions

View File

@ -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

View File

@ -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