diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2008-03-25 18:47:59 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2008-03-25 18:47:59 (GMT) |
commit | 8e85ffa4b213be809109180142a107a1ac66f4d5 (patch) | |
tree | be8be758b90490e46c83c0f0d4bbf49536bd0de2 /Lib/decimal.py | |
parent | cdde579fb9d3ccadff3f3e334d59b26aa74941f0 (diff) | |
download | cpython-8e85ffa4b213be809109180142a107a1ac66f4d5.zip cpython-8e85ffa4b213be809109180142a107a1ac66f4d5.tar.gz cpython-8e85ffa4b213be809109180142a107a1ac66f4d5.tar.bz2 |
Issue #2482: Make sure that the coefficient of a Decimal
instance is always stored as a str instance, even
when that Decimal has been created from a unicode string.
Diffstat (limited to 'Lib/decimal.py')
-rw-r--r-- | Lib/decimal.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py index b775bee..dc44170 100644 --- a/Lib/decimal.py +++ b/Lib/decimal.py @@ -557,17 +557,17 @@ class Decimal(object): fracpart = m.group('frac') exp = int(m.group('exp') or '0') if fracpart is not None: - self._int = (intpart+fracpart).lstrip('0') or '0' + self._int = str((intpart+fracpart).lstrip('0') or '0') self._exp = exp - len(fracpart) else: - self._int = intpart.lstrip('0') or '0' + self._int = str(intpart.lstrip('0') or '0') self._exp = exp self._is_special = False else: diag = m.group('diag') if diag is not None: # NaN - self._int = diag.lstrip('0') + self._int = str(diag.lstrip('0')) if m.group('signal'): self._exp = 'N' else: |