Skip to content

Commit

Permalink
Merge pull request #1321 from asmeurer/python3.3
Browse files Browse the repository at this point in the history
Fix Python 3.3 issues - standard library Decimal class
  • Loading branch information
Krastanov committed May 28, 2012
2 parents 22ca44e + 589653d commit 1f3fd71
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sympy/core/numbers.py
Expand Up @@ -56,10 +56,16 @@ def seterr(divide=False):

def _decimal_to_Rational_prec(dec):
"""Convert an ordinary decimal instance to a Rational."""
assert not dec._is_special
# _is_special is needed for Python 2.5 support; is_finite for Python 3.3
# support
nonfinite = getattr(dec, '_is_special', None)
if nonfinite is None:
nonfinite = not dec.is_finite()
if nonfinite:
raise TypeError("dec must be finite, got %s." % dec)
s, d, e = dec.as_tuple()
prec = len(d)
if dec._isinteger():
if int(dec) == dec:
rv = Rational(int(dec))
else:
s = (-1)**s
Expand Down

0 comments on commit 1f3fd71

Please sign in to comment.