mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
Fix issue #4730: cPickle corrupts high-unicode strings.
Update outdated copy of PyUnicode_EncodeRawUnicodeEscape. Add a test case.
This commit is contained in:
parent
034e08ce8d
commit
f852bf97ef
2 changed files with 87 additions and 31 deletions
|
@ -480,14 +480,21 @@ class AbstractPickleTests(unittest.TestCase):
|
|||
|
||||
if have_unicode:
|
||||
def test_unicode(self):
|
||||
endcases = [unicode(''), unicode('<\\u>'), unicode('<\\\u1234>'),
|
||||
unicode('<\n>'), unicode('<\\>')]
|
||||
endcases = [u'', u'<\\u>', u'<\\\\u1234>', u'<\n>',
|
||||
u'<\\>', u'<\\\\U00012345>']
|
||||
for proto in protocols:
|
||||
for u in endcases:
|
||||
p = self.dumps(u, proto)
|
||||
u2 = self.loads(p)
|
||||
self.assertEqual(u2, u)
|
||||
|
||||
def test_unicode_high_plane(self):
|
||||
t = u'\U00012345'
|
||||
for proto in protocols:
|
||||
p = self.dumps(t, proto)
|
||||
t2 = self.loads(p)
|
||||
self.assertEqual(t2, t)
|
||||
|
||||
def test_ints(self):
|
||||
import sys
|
||||
for proto in protocols:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue