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

lemburg@users.sourceforge.net lemburg@users.sourceforge.net
Tue, 04 Feb 2003 11:35:36 -0800


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv2848/Lib/test

Modified Files:
	test_codecs.py 
Log Message:
Fix for [ 543344 ] Interpreter crashes when recoding; suggested
by Michael Stone (mbrierst).

Python 2.1.4, 2.2.2 candidate.



Index: test_codecs.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecs.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** test_codecs.py	3 Sep 2002 13:53:40 -0000	1.4
--- test_codecs.py	4 Feb 2003 19:35:01 -0000	1.5
***************
*** 28,31 ****
--- 28,39 ----
          self.assertEquals(codecs.escape_decode(""), ("", 0))
  
+ class RecodingTest(unittest.TestCase):
+     def test_recoding(self):
+         f = StringIO.StringIO()
+         f2 = codecs.EncodedFile(f, "unicode_internal", "utf-8")
+         f2.write(u"a")
+         f2.close()
+         # Python used to crash on this at exit because of a refcount
+         # bug in _codecsmodule.c
  
  def test_main():
***************
*** 33,36 ****
--- 41,45 ----
      suite.addTest(unittest.makeSuite(UTF16Test))
      suite.addTest(unittest.makeSuite(EscapeDecodeTest))
+     suite.addTest(unittest.makeSuite(RecodingTest))
      test_support.run_suite(suite)