mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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
This commit is contained in:
parent
8e790e7007
commit
8709a420c4
2 changed files with 12 additions and 4 deletions
|
@ -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__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue