From a4a28fcb152c200220c286609545ca2ce6ef01b3 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Aug 14 2018 10:50:22 +0000 Subject: [PATCH 1/2] Fix _subexpr method in lambdify --- diff --git a/sympy-subexpr-lambdify.patch b/sympy-subexpr-lambdify.patch new file mode 100644 index 0000000..312a021 --- /dev/null +++ b/sympy-subexpr-lambdify.patch @@ -0,0 +1,52 @@ +--- sympy-sympy-1.2/sympy/utilities/lambdify.py.orig 2018-08-14 12:45:57.659778760 +0200 ++++ sympy-sympy-1.2/sympy/utilities/lambdify.py 2018-08-14 12:46:12.412849733 +0200 +@@ -741,8 +741,7 @@ + + return argstrs, expr + +- @staticmethod +- def _subexpr(expr, dummies_dict): ++ def _subexpr(self, expr, dummies_dict): + from sympy.matrices import DeferredVector + from sympy import sympify + +@@ -752,13 +751,13 @@ + if isinstance(expr, DeferredVector): + pass + elif isinstance(expr, dict): +- k = [sub_expr(sympify(a), dummies_dict) for a in expr.keys()] +- v = [sub_expr(sympify(a), dummies_dict) for a in expr.values()] ++ k = [self._subexpr(sympify(a), dummies_dict) for a in expr.keys()] ++ v = [self._subexpr(sympify(a), dummies_dict) for a in expr.values()] + expr = dict(zip(k, v)) + elif isinstance(expr, tuple): +- expr = tuple(sub_expr(sympify(a), dummies_dict) for a in expr) ++ expr = tuple(self._subexpr(sympify(a), dummies_dict) for a in expr) + elif isinstance(expr, list): +- expr = [sub_expr(sympify(a), dummies_dict) for a in expr] ++ expr = [self._subexpr(sympify(a), dummies_dict) for a in expr] + return expr + + def _print_funcargwrapping(self, args): + +--- sympy-sympy-1.2/sympy/utilities/tests/test_lambdify.py.orig 2018-08-14 12:46:10.396840035 +0200 ++++ sympy-sympy-1.2/sympy/utilities/tests/test_lambdify.py 2018-08-14 12:46:12.413849738 +0200 +@@ -883,3 +883,18 @@ + # Test that inspect.getsource works but don't hard-code implementation + # details + assert 'x**2' in inspect.getsource(f) ++ ++def test_issue_14941(): ++ x, y = Dummy(), Dummy() ++ ++ # test dict ++ f1 = lambdify([x, y], {x: 3, y: 3}, 'sympy') ++ assert f1(2, 3) == {2: 3, 3: 3} ++ ++ # test tuple ++ f2 = lambdify([x, y], (y, x), 'sympy') ++ assert f2(2, 3) == (3, 2) ++ ++ # test list ++ f3 = lambdify([x, y], [y, x], 'sympy') ++ assert f3(2, 3) == [3, 2] diff --git a/sympy.spec b/sympy.spec index 7701299..fc4062b 100644 --- a/sympy.spec +++ b/sympy.spec @@ -1,6 +1,6 @@ Name: sympy Version: 1.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A Python library for symbolic mathematics License: BSD URL: http://sympy.org/ @@ -11,6 +11,9 @@ Patch0: %{name}-float.patch Patch1: %{name}-test-code-quality.patch # Fix a couple of documentation typos Patch2: %{name}-doc.patch +# Fix _subexpr method in lambdify +# https://github.com/sympy/sympy/pull/14945 +Patch3: %{name}-subexpr-lambdify.patch BuildArch: noarch @@ -111,6 +114,7 @@ HTML documentation for sympy. %patch0 %patch1 %patch2 +%patch3 # If running on a 32-bit system, disable a test that requires 64-bit integers. %global maxpyint %(python3 -c 'import sys;print("%x" % sys.maxsize)') @@ -263,6 +267,9 @@ popd %{_docdir}/%{name}-doc/html %changelog +* Tue Aug 14 2018 Miro Hrončok - 1.2-2 +- Fix _subexpr method in lambdify + * Sat Jul 21 2018 Jerry James - 1.2-1 - Update to 1.2 (bz 1599502) - Drop upstreamed -python3 patch From 5125b8335b6a3561c26c49e3e50d93d86ecf67c7 Mon Sep 17 00:00:00 2001 From: Miro Hrončok Date: Aug 14 2018 11:40:36 +0000 Subject: [PATCH 2/2] Fix encoding of TeX source file --- diff --git a/sympy-tex-encoding.patch b/sympy-tex-encoding.patch new file mode 100644 index 0000000..961c0c9 --- /dev/null +++ b/sympy-tex-encoding.patch @@ -0,0 +1,20 @@ +--- sympy-sympy-1.2/doc/cheatsheet/combinatoric_cheatsheet.tex.orig 2018-07-09 18:27:56.000000000 +0200 ++++ sympy-sympy-1.2/doc/cheatsheet/combinatoric_cheatsheet.tex 2018-08-14 13:38:21.397200957 +0200 +@@ -425,7 +425,7 @@ + + + \verb!coset_factor(g, af=False)!\\ +-Return G�s (self�s) coset factorization, \verb!f,! of \verb!g!. ++Return G's (self's) coset factorization, \verb!f,! of \verb!g!. + + + +@@ -458,7 +458,7 @@ + + + \verb!generate_dimino(af=False)!\\ +-Yield group elements using Dimino�s algorithm ++Yield group elements using Dimino's algorithm + + + \verb!generate_schreier_sims(af=False)!\\ diff --git a/sympy.spec b/sympy.spec index fc4062b..5a4e1a6 100644 --- a/sympy.spec +++ b/sympy.spec @@ -14,6 +14,8 @@ Patch2: %{name}-doc.patch # Fix _subexpr method in lambdify # https://github.com/sympy/sympy/pull/14945 Patch3: %{name}-subexpr-lambdify.patch +# The TeX source has some weird symbols, we need to patch them out +Patch4: %{name}-tex-encoding.patch BuildArch: noarch @@ -115,6 +117,7 @@ HTML documentation for sympy. %patch1 %patch2 %patch3 +%patch4 # If running on a 32-bit system, disable a test that requires 64-bit integers. %global maxpyint %(python3 -c 'import sys;print("%x" % sys.maxsize)')