From: <pj...@us...> - 2009-05-28 02:58:25
|
Revision: 6409 http://jython.svn.sourceforge.net/jython/?rev=6409&view=rev Author: pjenvey Date: 2009-05-28 02:58:09 +0000 (Thu, 28 May 2009) Log Message: ----------- plug more leaky file handles in tarfile and test_pkgimport Modified Paths: -------------- trunk/jython/Lib/tarfile.py trunk/jython/Lib/test/test_pkgimport.py trunk/jython/Lib/test/test_tarfile.py Modified: trunk/jython/Lib/tarfile.py =================================================================== --- trunk/jython/Lib/tarfile.py 2009-05-28 01:46:11 UTC (rev 6408) +++ trunk/jython/Lib/tarfile.py 2009-05-28 02:58:09 UTC (rev 6409) @@ -1210,6 +1210,7 @@ try: t = cls.taropen(name, mode, fileobj) except IOError: + fileobj.close() raise ReadError("not a gzip file") t._extfileobj = False return t @@ -1235,6 +1236,7 @@ try: t = cls.taropen(name, mode, fileobj) except IOError: + fileobj.close() raise ReadError("not a bzip2 file") t._extfileobj = False return t Modified: trunk/jython/Lib/test/test_pkgimport.py =================================================================== --- trunk/jython/Lib/test/test_pkgimport.py 2009-05-28 01:46:11 UTC (rev 6408) +++ trunk/jython/Lib/test/test_pkgimport.py 2009-05-28 02:58:09 UTC (rev 6409) @@ -22,7 +22,8 @@ self.package_dir = os.path.join(self.test_dir, self.package_name) os.mkdir(self.package_dir) - open(os.path.join(self.package_dir, '__init__'+os.extsep+'py'), 'w') + open(os.path.join(self.package_dir, '__init__'+os.extsep+'py'), + 'w').close() self.module_path = os.path.join(self.package_dir, 'foo'+os.extsep+'py') def tearDown(self): Modified: trunk/jython/Lib/test/test_tarfile.py =================================================================== --- trunk/jython/Lib/test/test_tarfile.py 2009-05-28 01:46:11 UTC (rev 6408) +++ trunk/jython/Lib/test/test_tarfile.py 2009-05-28 02:58:09 UTC (rev 6409) @@ -727,6 +727,7 @@ def test_no_name_argument(self): fobj = open(testtar, "rb") + self.tar.close() self.tar = tarfile.open(fileobj=fobj, mode="r") self.assertEqual(self.tar.name, os.path.abspath(fobj.name)) fobj.close() @@ -737,6 +738,7 @@ fp.close() fobj = StringIO.StringIO(data) self.assertRaises(AttributeError, getattr, fobj, "name") + self.tar.close() self.tar = tarfile.open(fileobj=fobj, mode="r") self.assertEqual(self.tar.name, None) @@ -746,6 +748,7 @@ fp.close() fobj = StringIO.StringIO(data) fobj.name = "" + self.tar.close() self.tar = tarfile.open(fileobj=fobj, mode="r") self.assertEqual(self.tar.name, None) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |