[Python-checkins] python/dist/src/Lib/test test_codecs.py,1.3,1.4

doerwalter@users.sourceforge.net doerwalter@users.sourceforge.net
2002年9月03日 06:53:42 -0700


Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv21090/Lib/test
Modified Files:
	test_codecs.py 
Log Message:
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
Index: test_codecs.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecs.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** test_codecs.py	23 Jul 2002 19:03:46 -0000	1.3
--- test_codecs.py	3 Sep 2002 13:53:40 -0000	1.4
***************
*** 24,30 ****
 self.assertEquals(f.read(), u"spamspam")
 
 
 def test_main():
! test_support.run_unittest(UTF16Test)
 
 
--- 24,37 ----
 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():
! suite = unittest.TestSuite()
! suite.addTest(unittest.makeSuite(UTF16Test))
! suite.addTest(unittest.makeSuite(EscapeDecodeTest))
! test_support.run_suite(suite)
 
 

AltStyle によって変換されたページ (->オリジナル) /