Merged revisions 85503 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85503 | antoine.pitrou | 2010-10-15 00:11:44 +0200 (ven., 15 oct. 2010) | 2 lines

  More proper closing of files
........
diff --git a/Lib/test/test_multibytecodec.py b/Lib/test/test_multibytecodec.py
index 95ca0ab..63c1e62 100644
--- a/Lib/test/test_multibytecodec.py
+++ b/Lib/test/test_multibytecodec.py
@@ -46,12 +46,9 @@
                           'apple\x92ham\x93spam', 'test.cjktest')
 
     def test_codingspec(self):
-        try:
-            for enc in ALL_CJKENCODINGS:
-                print >> open(TESTFN, 'w'), '# coding:', enc
-                exec open(TESTFN)
-        finally:
-            os.unlink(TESTFN)
+        for enc in ALL_CJKENCODINGS:
+            code = '# coding: {}\n'.format(enc)
+            exec code
 
     def test_init_segfault(self):
         # bug #3305: this used to segfault