Status: New
Owner: ----
Labels: Type-Defect Priority-Medium Simplify

New issue 3312 by laurence.gonsalves: "RuntimeError: maximum recursion depth exceeded" in sympy.cse
http://code.google.com/p/sympy/issues/detail?id=3312

This code:

    import sympy
    a = sympy.Function('a')
    b = sympy.Function('b')
    ma = sympy.Matrix([[a(0),a(1)], [a(2),a(3)]])
    mb = sympy.Matrix([[b(0),b(1)], [b(2),b(3)]])
    sympy.cse(ma * mb)

Results in a traceback that looks like this:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
File "/blahblah/python2.7/site-packages/sympy/simplify/cse_main.py", line 116, in cse
        exprs = [preprocess_for_cse(e, optimizations) for e in exprs]
File "/blahblah/python2.7/site-packages/sympy/simplify/cse_main.py", line 43, in preprocess_for_cse
        expr = pre(expr)
File "/blahblah/python2.7/site-packages/sympy/simplify/cse_opts.py", line 50, in sub_pre
        assumed(a, 'is_negative')):
File "/blahblah/python2.7/site-packages/sympy/simplify/cse_opts.py", line 23, in assumed
        return getattr(e, name, False)
File "/blahblah/python2.7/site-packages/sympy/core/assumptions.py", line 369, in getit
        return self._what_known_about(name)
File "/blahblah/python2.7/site-packages/sympy/core/assumptions.py", line 301, in _what_known_about
        c = cmp(v, 0)
File "/blahblah/python2.7/site-packages/sympy/core/decorators.py", line 75, in __sympifyit_wrapper
        return func(a, sympify(b, strict=True))
File "/blahblah/python2.7/site-packages/sympy/core/expr.py", line 139, in __lt__
        if dif.is_negative != dif.is_nonnegative:
File "/blahblah/python2.7/site-packages/sympy/core/assumptions.py", line 369, in getit
        return self._what_known_about(name)
File "/blahblah/python2.7/site-packages/sympy/core/assumptions.py", line 301, in _what_known_about
        c = cmp(v, 0)
File "/blahblah/python2.7/site-packages/sympy/core/decorators.py", line 75, in __sympifyit_wrapper
        return func(a, sympify(b, strict=True))
      ...
File "/blahblah/python2.7/site-packages/sympy/core/expr.py", line 139, in __lt__
        if dif.is_negative != dif.is_nonnegative:
File "/blahblah/python2.7/site-packages/sympy/core/assumptions.py", line 369, in getit
        return self._what_known_about(name)
File "/blahblah/python2.7/site-packages/sympy/core/assumptions.py", line 301, in _what_known_about
        c = cmp(v, 0)
File "/blahblah/python2.7/site-packages/sympy/core/decorators.py", line 75, in __sympifyit_wrapper
        return func(a, sympify(b, strict=True))
File "/blahblah/python2.7/site-packages/sympy/core/expr.py", line 138, in __lt__
        dif = self - other
File "/blahblah/python2.7/site-packages/sympy/core/decorators.py", line 75, in __sympifyit_wrapper
        return func(a, sympify(b, strict=True))
File "/blahblah/python2.7/site-packages/sympy/core/decorators.py", line 115, in binary_op_wrapper
        return func(self, other)
File "/blahblah/python2.7/site-packages/sympy/core/expr.py", line 87, in __sub__
        return Add(self, -other)
File "/blahblah/python2.7/site-packages/sympy/core/cache.py", line 98, in wrapper
        return func_cache_it_cache[k]
File "/blahblah/python2.7/site-packages/sympy/core/numbers.py", line 1127, in __hash__
        return super(Integer, self).__hash__()
RuntimeError: maximum recursion depth exceeded while calling a Python object

The 4 stack frames before/after the ellipsis are repeating approximately one bazillion times.

This is with sympy 0.7.1 on Python 2.7 on Mac OS X 10.6.8. (Python and sympy are both from MacPorts.)

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to