[Python-checkins] r70044 - python/branches/io-c/Lib/test/test_io.py
antoine.pitrou
python-checkins at python.org
Sat Feb 28 02:18:34 CET 2009
Author: antoine.pitrou
Date: Sat Feb 28 02:18:34 2009
New Revision: 70044
Log:
Better resource cleanup
Modified:
python/branches/io-c/Lib/test/test_io.py
Modified: python/branches/io-c/Lib/test/test_io.py
==============================================================================
--- python/branches/io-c/Lib/test/test_io.py (original)
+++ python/branches/io-c/Lib/test/test_io.py Sat Feb 28 02:18:34 2009
@@ -351,12 +351,10 @@
print("Use 'regrtest.py -u largefile test_io' to run it.",
file=sys.stderr)
return
- f = self.open(support.TESTFN, "w+b", 0)
- self.large_file_ops(f)
- f.close()
- f = self.open(support.TESTFN, "w+b")
- self.large_file_ops(f)
- f.close()
+ with self.open(support.TESTFN, "w+b", 0) as f:
+ self.large_file_ops(f)
+ with self.open(support.TESTFN, "w+b") as f:
+ self.large_file_ops(f)
def test_with_open(self):
for bufsize in (0, 1, 100):
More information about the Python-checkins
mailing list