Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Do Not Merge] RuntimeError if SYMPY_USE_CACHE='no' #9194

Closed
wants to merge 6 commits into from

Conversation

pzrq
Copy link
Contributor

@pzrq pzrq commented Mar 24, 2015

I do not want this merged as is, this is just a point to start the discussion on how to fix it as it makes it a lot harder to debug other issues I am trying to resolve.

Basically I have used the following file, which turns off the SymPy cache and runs a test from the existing solution:
https://gist.github.com/pzrq/05a5d1a16c63e7485110

The commit messages indicate the detected results in that I at least (Mac OSX, Python 2.7) am seeing stack traces that result in:
RuntimeError: maximum recursion depth exceeded

The first one seems to be attempting something like zero -> algebraic -> imaginary -> negative [then always recursively loops back to negative, the exact route depends on a shuffle].

I have not looked in detail at the second one, just ran the gist. Usage was just a variation on python test.py, fed into git bisect or other commands as needed.

Merge commit '41557f563821d9d77c71ed0edb23e80c00467b4c' into runtimeerror-if-no-cache
Revert "simplify Mul._eval_is_negative routine"

This reverts commit 41557f5.
Merge commit '1c3b046c9831553dd18d98bcf5765c325df92eb6' into runtimeerror-if-no-cache
…ffb737d3209547fe6e76a9bb7845a0' into runtimeerror-if-no-cache
Revert "add _monotonic_sign and use in Add._eval_is_(pos, neg, npos, nneg)"

This reverts commit d1a454a.
…ntimeError with SYMPY_USE_CACHE='no']

Merge branch 'master' into runtimeerror-if-no-cache
@pzrq pzrq changed the title RuntimeError if SYMPY_USE_CACHE='no' [Do Not Merge] RuntimeError if SYMPY_USE_CACHE='no' Mar 24, 2015
@pzrq
Copy link
Contributor Author

pzrq commented Mar 25, 2015

Reproduced on master with no additional test files, just a console:

In [1]: import os

In [2]: os.environ['SYMPY_USE_CACHE'] = 'no'

In [3]: import sympy

In [4]: sympy.test('sympy/integrals/tests/test_integrals', kw='test_issue_4737')
=========================================== test process starts ============================================
executable:         /Users/pzrq/.virtualenvs/sympy/bin/python  (2.7.6-final-0) [CPython]
architecture:       64-bit
cache:              no
ground types:       python 
random seed:        41546754
hash randomization: on (PYTHONHASHSEED=2660920852)

sympy/integrals/tests/test_integrals.py[1] E                                                          [FAIL]

____________________________________________________________________________________________________________
_________________________ sympy/integrals/tests/test_integrals.py:test_issue_4737 __________________________
  File "/users/pzrq/projects/sympy/sympy/integrals/tests/test_integrals.py", line 964, in test_issue_4737
    assert integrate(sin(x)/x, (x, -oo, oo)) == pi
  File "sympy/utilities/decorator.py", line 35, in threaded_func
    return func(expr, *args, **kwargs)
  File "sympy/integrals/integrals.py", line 1254, in integrate
    risch=risch, manual=manual)
  File "sympy/integrals/integrals.py", line 390, in doit
    if self.is_zero:
  File "sympy/core/assumptions.py", line 245, in getit
    return _ask(fact, self)
  File "sympy/core/assumptions.py", line 288, in _ask
    a = evaluate(obj)
  File "sympy/integrals/integrals.py", line 109, in _eval_is_zero
    if self.function.is_zero:
  File "sympy/core/assumptions.py", line 245, in getit
    return _ask(fact, self)
  File "sympy/core/assumptions.py", line 288, in _ask
    a = evaluate(obj)
  File "sympy/core/mul.py", line 993, in _eval_is_zero
    z = a.is_zero
  File "sympy/core/assumptions.py", line 245, in getit
    return _ask(fact, self)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 288, in _ask
    a = evaluate(obj)
  File "sympy/core/power.py", line 983, in _eval_is_algebraic
    if self.base.is_zero or (self.base - 1).is_zero:
  File "sympy/core/assumptions.py", line 245, in getit
    return _ask(fact, self)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 288, in _ask
    a = evaluate(obj)
  File "sympy/core/add.py", line 469, in _eval_is_imaginary
    r = _fuzzy_group(a.is_real for a in iargs)
  File "sympy/core/logic.py", line 52, in _fuzzy_group
    for a in args:
  File "sympy/core/add.py", line 469, in <genexpr>
    r = _fuzzy_group(a.is_real for a in iargs)
  File "sympy/core/assumptions.py", line 245, in getit
    return _ask(fact, self)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 288, in _ask
    a = evaluate(obj)
  File "sympy/core/mul.py", line 1008, in _eval_is_integer
    is_rational = self.is_rational
  File "sympy/core/assumptions.py", line 245, in getit
    return _ask(fact, self)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 288, in _ask
    a = evaluate(obj)
  File "sympy/core/mul.py", line 1150, in _eval_is_negative
    return (-self).is_positive
  File "sympy/core/assumptions.py", line 245, in getit
    return _ask(fact, self)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 288, in _ask
    a = evaluate(obj)
  File "sympy/core/mul.py", line 1150, in _eval_is_negative
    return (-self).is_positive
  File "sympy/core/assumptions.py", line 245, in getit
    return _ask(fact, self)
  File "sympy/core/assumptions.py", line 300, in _ask
    _ask(pk, obj)
  File "sympy/core/assumptions.py", line 288, in _ask
    a = evaluate(obj)
  File "sympy/core/mul.py", line 1150, in _eval_is_negative
    return (-self).is_positive

< Removed lots more output for readability>

RuntimeError: maximum recursion depth exceeded while calling a Python object

========================= tests finished: 0 passed, 1 exceptions, in 0.23 seconds ==========================
DO *NOT* COMMIT!
Out[4]: False

@pzrq
Copy link
Contributor Author

pzrq commented Apr 7, 2015

Generalised on #8266

@pzrq pzrq closed this Apr 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant