mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
#6373: SystemError in str.encode('latin1', 'surrogateescape')
if the string contains unpaired surrogates. (In debug build, crash in assert()) This can happen with normal processing, if python starts with utf-8, then calls sys.setfilesystemencoding('latin-1')
This commit is contained in:
parent
f909202c11
commit
84ec8d9314
3 changed files with 11 additions and 0 deletions
|
@ -1549,6 +1549,11 @@ class SurrogateEscapeTest(unittest.TestCase):
|
|||
self.assertEqual("foo\udca5bar".encode("iso-8859-3", "surrogateescape"),
|
||||
b"foo\xa5bar")
|
||||
|
||||
def test_latin1(self):
|
||||
# Issue6373
|
||||
self.assertEqual("\udce4\udceb\udcef\udcf6\udcfc".encode("latin1", "surrogateescape"),
|
||||
b"\xe4\xeb\xef\xf6\xfc")
|
||||
|
||||
|
||||
def test_main():
|
||||
support.run_unittest(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue