summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_multibytecodec.py
diff options
context:
space:
mode:
authorChristopher Thorne <libcthorne@users.noreply.github.com>2018-11-02 03:29:40 (GMT)
committerINADA Naoki <methane@users.noreply.github.com>2018-11-02 03:29:40 (GMT)
commit488c0a6cdf09e21774e63c2a430ecc0de804d147 (patch)
tree2bcddc07c0880a2a9ec20edaddae469bce743287 /Lib/test/test_multibytecodec.py
parent318ab63c01f5b8e7562b122ab5ba01258a51277b (diff)
downloadcpython-488c0a6cdf09e21774e63c2a430ecc0de804d147.zip
cpython-488c0a6cdf09e21774e63c2a430ecc0de804d147.tar.gz
cpython-488c0a6cdf09e21774e63c2a430ecc0de804d147.tar.bz2
bpo-33578: Fix getstate/setstate for CJK decoder (GH-10290)
Previous version was casting to Py_ssize_t incorrectly and exhibited unexpected behavior on big-endian systems.
Diffstat (limited to 'Lib/test/test_multibytecodec.py')
-rw-r--r--Lib/test/test_multibytecodec.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
index 8e8362b..3cf5d7b 100644
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -271,6 +271,10 @@ class Test_IncrementalDecoder(unittest.TestCase):
pending4, _ = decoder.getstate()
self.assertEqual(pending4, b'')
+ # Ensure state values are preserved correctly
+ decoder.setstate((b'abc', 123456789))
+ self.assertEqual(decoder.getstate(), (b'abc', 123456789))
+
def test_setstate_validates_input(self):
decoder = codecs.getincrementaldecoder('euc_jp')()
self.assertRaises(TypeError, decoder.setstate, 123)