Issue #2482: Make sure that the coefficient of a Decimal instance
is stored as a str instance rather than a unicode instance.
Backported from Python 2.6 (see r61904).
diff --git a/Lib/decimal.py b/Lib/decimal.py
index 8b3e252..591f4de 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -549,17 +549,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: