mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
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.
This commit is contained in:
parent
318ab63c01
commit
488c0a6cdf
2 changed files with 26 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue