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.
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 @@
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: