diff options
author | Walter Dörwald <walter@livinglogic.de> | 2002-09-03 13:53:40 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2002-09-03 13:53:40 (GMT) |
commit | 8709a420c46aac08c2e692ab8fe181c1deb61e11 (patch) | |
tree | 995b63b7da361cdefe0042cfdc2b5dccbf013869 /Lib/test/test_codecs.py | |
parent | 8e790e700777cdb0fdecf3acaf53d5ad06784501 (diff) | |
download | cpython-8709a420c46aac08c2e692ab8fe181c1deb61e11.zip cpython-8709a420c46aac08c2e692ab8fe181c1deb61e11.tar.gz cpython-8709a420c46aac08c2e692ab8fe181c1deb61e11.tar.bz2 |
Check whether a string resize is necessary at the end
of PyString_DecodeEscape(). This prevents a call to
_PyString_Resize() for the empty string, which would
result in a PyErr_BadInternalCall(), because the
empty string has more than one reference.
This closes SF bug http://www.python.org/sf/603937
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r-- | Lib/test/test_codecs.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index 0362d26..36cebd5 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -23,9 +23,16 @@ class UTF16Test(unittest.TestCase): f = reader(s) self.assertEquals(f.read(), u"spamspam") +class EscapeDecodeTest(unittest.TestCase): + def test_empty_escape_decode(self): + self.assertEquals(codecs.escape_decode(""), ("", 0)) + def test_main(): - test_support.run_unittest(UTF16Test) + suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(UTF16Test)) + suite.addTest(unittest.makeSuite(EscapeDecodeTest)) + test_support.run_suite(suite) if __name__ == "__main__": |