void-packages/srcpkgs/python3-sympy/patches/00.python3.12.patch

141 lines
6.6 KiB
Diff

From f517c26fe421f03ea2aa20d7babb4df422753c5f Mon Sep 17 00:00:00 2001
From: Sangyub Lee <sylee957@gmail.com>
Date: Tue, 30 May 2023 10:38:29 +0900
Subject: [PATCH 1/3] Fix deprecation issues with python 3.12 ast lib
---
sympy/parsing/sympy_parser.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sympy/parsing/sympy_parser.py b/sympy/parsing/sympy_parser.py
index 7e3a0e8067ce..5cda6b61ad69 100644
--- a/sympy/parsing/sympy_parser.py
+++ b/sympy/parsing/sympy_parser.py
@@ -1135,7 +1135,7 @@ def visit_Compare(self, node):
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
)
@@ -1168,7 +1168,7 @@ def visit_BinOp(self, node):
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()))],
+ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))],
starargs=None,
kwargs=None
)
@@ -1179,7 +1179,7 @@ def visit_BinOp(self, node):
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()))],
+ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))],
starargs=None,
kwargs=None
)
@@ -1187,7 +1187,7 @@ def visit_BinOp(self, node):
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()))],
+ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))],
starargs=None,
kwargs=None
)
@@ -1197,7 +1197,7 @@ def visit_BinOp(self, node):
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
)
@@ -1212,7 +1212,7 @@ def visit_BinOp(self, node):
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())))
return new_node
From 34de3853a9486e23294d28b932d5978e237bc19c Mon Sep 17 00:00:00 2001
From: Sangyub Lee <sylee957@gmail.com>
Date: Tue, 30 May 2023 13:17:17 +0900
Subject: [PATCH 2/3] Replace ast.Num
---
sympy/parsing/sympy_parser.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sympy/parsing/sympy_parser.py b/sympy/parsing/sympy_parser.py
index 5cda6b61ad69..4a45a9d5bff8 100644
--- a/sympy/parsing/sympy_parser.py
+++ b/sympy/parsing/sympy_parser.py
@@ -1167,7 +1167,7 @@ def visit_BinOp(self, node):
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],
+ 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
@@ -1178,7 +1178,7 @@ def visit_BinOp(self, node):
rev = True
left = ast.Call(
func=ast.Name(id='Pow', ctx=ast.Load()),
- args=[left, ast.UnaryOp(op=ast.USub(), operand=ast.Num(1))],
+ 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
@@ -1186,7 +1186,7 @@ def visit_BinOp(self, node):
else:
right = ast.Call(
func=ast.Name(id='Pow', ctx=ast.Load()),
- args=[right, ast.UnaryOp(op=ast.USub(), operand=ast.Num(1))],
+ 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
From eae2a0810829682417ba17e30812faa949121cc2 Mon Sep 17 00:00:00 2001
From: Sangyub Lee <sylee957@gmail.com>
Date: Tue, 30 May 2023 13:53:44 +0900
Subject: [PATCH 3/3] Fix additional deprecation warnings
---
sympy/parsing/ast_parser.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sympy/parsing/ast_parser.py b/sympy/parsing/ast_parser.py
index c828ed31a19b..95a773d5bec6 100644
--- a/sympy/parsing/ast_parser.py
+++ b/sympy/parsing/ast_parser.py
@@ -23,7 +23,7 @@
from sympy.core.sympify import SympifyError
from ast import parse, NodeTransformer, Call, Name, Load, \
- fix_missing_locations, Str, Tuple
+ fix_missing_locations, Constant, Tuple
class Transform(NodeTransformer):
@@ -52,7 +52,7 @@ def visit_Name(self, node):
elif node.id in ['True', 'False']:
return node
return fix_missing_locations(Call(func=Name('Symbol', Load()),
- args=[Str(node.id)], keywords=[]))
+ args=[Constant(node.id)], keywords=[]))
def visit_Lambda(self, node):
args = [self.visit(arg) for arg in node.args.args]