summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-06-20 09:49:42 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-06-20 09:49:42 (GMT)
commite5a0a9609faea9afdc6f81f1f6dfa07b1437e3ae (patch)
tree3c7d0cfc0f4c606b6e64dbd1238e9fac191e5373 /Lib
parenta7daba6866136d1c554ba6bf278e9ddaf52ecac6 (diff)
downloadcpython-e5a0a9609faea9afdc6f81f1f6dfa07b1437e3ae.zip
cpython-e5a0a9609faea9afdc6f81f1f6dfa07b1437e3ae.tar.gz
cpython-e5a0a9609faea9afdc6f81f1f6dfa07b1437e3ae.tar.bz2
Apply the _is_special guard.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/decimal.py25
1 files changed, 13 insertions, 12 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py
index 4a91c55..1e5b291 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -760,18 +760,19 @@ class Decimal(object):
Captures all of the information in the underlying representation.
"""
- if self._isnan():
- minus = '-'*self._sign
- if self._int == (0,):
- info = ''
- else:
- info = ''.join(map(str, self._int))
- if self._isnan() == 2:
- return minus + 'sNaN' + info
- return minus + 'NaN' + info
- if self._isinfinity():
- minus = '-'*self._sign
- return minus + 'Infinity'
+ if self._is_special:
+ if self._isnan():
+ minus = '-'*self._sign
+ if self._int == (0,):
+ info = ''
+ else:
+ info = ''.join(map(str, self._int))
+ if self._isnan() == 2:
+ return minus + 'sNaN' + info
+ return minus + 'NaN' + info
+ if self._isinfinity():
+ minus = '-'*self._sign
+ return minus + 'Infinity'
if context is None:
context = getcontext()