summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_decimal.py
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2014-04-29 16:23:35 (GMT)
committerStefan Krah <skrah@bytereef.org>2014-04-29 16:23:35 (GMT)
commitf1d4e421953e7132a84f4ec5513ddb80d7e29174 (patch)
treec62467695236fd8f31de60f48cd40b48d15e17a6 /Lib/test/test_decimal.py
parentae43046b614439234de596ddad9d6d07b15092aa (diff)
downloadcpython-f1d4e421953e7132a84f4ec5513ddb80d7e29174.zip
cpython-f1d4e421953e7132a84f4ec5513ddb80d7e29174.tar.gz
cpython-f1d4e421953e7132a84f4ec5513ddb80d7e29174.tar.bz2
Issue #21374: Fix pickling of DecimalTuple.
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r--Lib/test/test_decimal.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py
index 4031347..4b27907 100644
--- a/Lib/test/test_decimal.py
+++ b/Lib/test/test_decimal.py
@@ -2431,6 +2431,23 @@ class PythonAPItests(unittest.TestCase):
self.assertIsInstance(r, C.Decimal)
self.assertEqual(r, x)
+ x = C.Decimal('-3.123e81723').as_tuple()
+ y = P.Decimal('-3.123e81723').as_tuple()
+
+ sys.modules['decimal'] = C
+ sx = pickle.dumps(x)
+ sys.modules['decimal'] = P
+ r = pickle.loads(sx)
+ self.assertIsInstance(r, P.DecimalTuple)
+ self.assertEqual(r, y)
+
+ sys.modules['decimal'] = P
+ sy = pickle.dumps(y)
+ sys.modules['decimal'] = C
+ r = pickle.loads(sy)
+ self.assertIsInstance(r, C.DecimalTuple)
+ self.assertEqual(r, x)
+
sys.modules['decimal'] = savedecimal
def test_int(self):