Status: Valid
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 3616 by [email protected]: Rational failure with gmpy
http://code.google.com/p/sympy/issues/detail?id=3616

With gmpy:

In [1]: Rational(1.0, 3)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-ff946488079a> in <module>()
----> 1 Rational(1.0, 3)

/home/ondrej/repos/sympy/sympy/core/cache.pyc in wrapper(*args, **kw_args)
     90         except KeyError:
     91             pass
---> 92         func_cache_it_cache[k] = r = func(*args, **kw_args)
     93         return r
     94     return wrapper

/home/ondrej/repos/sympy/sympy/core/numbers.pyc in __new__(cls, p, q)
   1047             q = S.One
   1048         else:
-> 1049             p = Rational(p)
   1050             q = Rational(q)
   1051

/home/ondrej/repos/sympy/sympy/core/cache.pyc in wrapper(*args, **kw_args)
     90         except KeyError:
     91             pass
---> 92         func_cache_it_cache[k] = r = func(*args, **kw_args)
     93         return r
     94     return wrapper

/home/ondrej/repos/sympy/sympy/core/numbers.pyc in __new__(cls, p, q)
   1041
   1042                 if isinstance(p, (float, Float)):
-> 1043                     return Rational(*_as_integer_ratio(p))
   1044
   1045             if not isinstance(p, (int, long, Rational)):

/home/ondrej/repos/sympy/sympy/core/cache.pyc in wrapper(*args, **kw_args)
     90         except KeyError:
     91             pass
---> 92         func_cache_it_cache[k] = r = func(*args, **kw_args)
     93         return r
     94     return wrapper

/home/ondrej/repos/sympy/sympy/core/numbers.pyc in __new__(cls, p, q)
   1047             q = S.One
   1048         else:
-> 1049             p = Rational(p)
   1050             q = Rational(q)
   1051

/home/ondrej/repos/sympy/sympy/core/cache.pyc in wrapper(*args, **kw_args)
     90         except KeyError:
     91             pass
---> 92         func_cache_it_cache[k] = r = func(*args, **kw_args)
     93         return r
     94     return wrapper

/home/ondrej/repos/sympy/sympy/core/numbers.pyc in __new__(cls, p, q)
   1044
   1045             if not isinstance(p, (int, long, Rational)):
-> 1046                 raise TypeError('invalid input: %s' % p)
   1047             q = S.One
   1048         else:

TypeError: invalid input: 1



Without:

Rational(1.0, 3)
1/3


This is a cause of failures reported by Travis-CI with gmpy turned on, see
https://github.com/sympy/sympy/pull/1756

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


Reply via email to