#2 Fix _subexpr method in lambdify
Merged 2 years ago by churchyard. Opened 2 years ago by churchyard.
rpms/ churchyard/sympy subexpr  into  master

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

@@ -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)!\\

file modified
+11 -1

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

  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

+ # The TeX source has some weird symbols, we need to patch them out

+ Patch4:         %{name}-tex-encoding.patch

  

  BuildArch:      noarch

  

@@ -111,6 +116,8 @@ 

  %patch0

  %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)')

@@ -263,6 +270,9 @@ 

  %{_docdir}/%{name}-doc/html

  

  %changelog

+ * Tue Aug 14 2018 Miro Hrončok <mhroncok@redhat.com> - 1.2-2

+ - Fix _subexpr method in lambdify

+ 

  * Sat Jul 21 2018 Jerry James <loganjerry@gmail.com> - 1.2-1

  - Update to 1.2 (bz 1599502)

  - Drop upstreamed -python3 patch

no initial comment

(Never tested, will wait for the CI and try it.)

1 new commit added

  • Fix encoding of TeX source files
2 years ago

2 new commits added

  • Fix encoding of TeX source files
  • Fix _subexpr method in lambdify
2 years ago

2 new commits added

  • Fix encoding of TeX source file
  • Fix _subexpr method in lambdify
2 years ago

just go ahead, merge the nipy thing and build both please.

I wanted to give @jjames some heads up. It can wait couple more hours, even a day.

Thanks for figuring out the fix @churchyard . Please feel free to merge and build.

Pull-Request has been merged by churchyard

2 years ago