diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2009-06-29 22:38:54 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2009-06-29 22:38:54 (GMT) |
commit | e5344d6c45f15e8cd5b450311a402de568f54b47 (patch) | |
tree | 150fa35d9135b3d2c751fdf192a0659e54ef28a5 /Lib/test/test_codecs.py | |
parent | 77b31ef202359e6f29d261b7dfbb356f36d49123 (diff) | |
download | cpython-e5344d6c45f15e8cd5b450311a402de568f54b47.zip cpython-e5344d6c45f15e8cd5b450311a402de568f54b47.tar.gz cpython-e5344d6c45f15e8cd5b450311a402de568f54b47.tar.bz2 |
Merged revisions 73698 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r73698 | amaury.forgeotdarc | 2009-06-30 00:36:49 +0200 (mar., 30 juin 2009) | 7 lines
#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')
........
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r-- | Lib/test/test_codecs.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index 4ec7b58..e060471 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -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( |