Status: Accepted
Owner: asmeurer
Labels: Type-Defect Priority-High Milestone-Release0.7.0
New issue 1946 by asmeurer: Recursion error with SYMPY_GROUND_TYPES=sympy
(caching problem)
http://code.google.com/p/sympy/issues/detail?id=1946
dhcp-baca-230:sympy aaronmeurer(master$)$SYMPY_GROUND_TYPES=sympy ./bin/test
sympy/polys/tests/test_galoistools.py -k test_gf_ddf
============================= test process starts
==============================
executable:
/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/
Python (2.6.5-final-0)
sympy/polys/tests/test_galoistools.py[1] E
[FAIL]
________________________________________________________________________________
______________ sympy/polys/tests/test_galoistools.py:test_gf_ddf
_______________
File
"/users/aaronmeurer/documents/python/sympy/sympy/sympy/polys/tests/test_galoistools.py",
line 522, in test_gf_ddf
assert gf_ddf_shoup(f, p, ZZ) == g
File "/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/galoistools.py",
line
1147, in gf_ddf_shoup
U[i] = gf_compose_mod(U[i-1], h, f, p, K)
File "/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/galoistools.py",
line
658, in gf_compose_mod
comp = gf_mul(comp, h, p, K)
File "/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/polys/galoistools.py",
line
281, in gf_mul
coeff += f[j]*g[i-j]
File "/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/numbers.py",
line
856, in __add__
return Integer(a.p + b.p)
File "/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/numbers.py",
line
814, in __new__
return _intcache[i]
File "/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/numbers.py",
line
904, in __eq__
return Rational.__eq__(a, b)
File "/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/numbers.py",
line
656, in __eq__
other = _sympify(other)
File "/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/sympify.py",
line 153,
in _sympify
return Integer(a)
File "/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/numbers.py",
line
814, in __new__
return _intcache[i]
File "/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/numbers.py",
line
904, in __eq__
return Rational.__eq__(a, b)
File "/Users/aaronmeurer/Documents/python/sympy/sympy/sympy/core/numbers.py",
line
...
RuntimeError: maximum recursion depth exceeded while calling a Python object
This fixes it, but I'm not sure if it is the right way to do it:
diff --git a/sympy/core/numbers.py b/sympy/core/numbers.py
index 34502eb..b0faba9 100644
--- a/sympy/core/numbers.py
+++ b/sympy/core/numbers.py
@@ -811,7 +811,7 @@ def _mpmath_(self, prec, rnd):
@int_trace
def __new__(cls, i):
try:
- return _intcache[i]
+ return _intcache[int(i)]
except KeyError:
# We only work with well-behaved integer types. This converts,
for
# example, numpy.int32 instances.
--
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.