summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_codecs.py
diff options
context:
space:
mode:
authorMarc-André Lemburg <mal@egenix.com>2003-02-04 19:35:03 (GMT)
committerMarc-André Lemburg <mal@egenix.com>2003-02-04 19:35:03 (GMT)
commit29273c87da0ef361f84fee41385f7c991536f9cd (patch)
tree651170a5da2d5037eb72445a91d3132c94bd083a /Lib/test/test_codecs.py
parent604ade4ebd258300776009fa462eb23ea4a24e2e (diff)
downloadcpython-29273c87da0ef361f84fee41385f7c991536f9cd.zip
cpython-29273c87da0ef361f84fee41385f7c991536f9cd.tar.gz
cpython-29273c87da0ef361f84fee41385f7c991536f9cd.tar.bz2
Fix for [ 543344 ] Interpreter crashes when recoding; suggested
by Michael Stone (mbrierst). Python 2.1.4, 2.2.2 candidate.
Diffstat (limited to 'Lib/test/test_codecs.py')
-rw-r--r--Lib/test/test_codecs.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py
index 36cebd5..9a4f35f 100644
--- a/Lib/test/test_codecs.py
+++ b/Lib/test/test_codecs.py
@@ -27,11 +27,20 @@ class EscapeDecodeTest(unittest.TestCase):
def test_empty_escape_decode(self):
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():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(UTF16Test))
suite.addTest(unittest.makeSuite(EscapeDecodeTest))
+ suite.addTest(unittest.makeSuite(RecodingTest))
test_support.run_suite(suite)