summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect.py
diff options
context:
space:
mode:
authorPhilip Jenvey <pjenvey@underboss.org>2009-05-28 05:58:44 (GMT)
committerPhilip Jenvey <pjenvey@underboss.org>2009-05-28 05:58:44 (GMT)
commit6a111027f2c1607d3e03acee6256eef38fafb206 (patch)
tree02725b4ef18fc23ba7ccb421f4ab388cab7cc0b9 /Lib/test/test_inspect.py
parentdd0388a1c218d1ae2074d56b19e8e765a254c938 (diff)
downloadcpython-6a111027f2c1607d3e03acee6256eef38fafb206.zip
cpython-6a111027f2c1607d3e03acee6256eef38fafb206.tar.gz
cpython-6a111027f2c1607d3e03acee6256eef38fafb206.tar.bz2
explicitly close files
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r--Lib/test/test_inspect.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py
index 4e597f9..144f89c 100644
--- a/Lib/test/test_inspect.py
+++ b/Lib/test/test_inspect.py
@@ -170,7 +170,8 @@ class GetSourceBase(unittest.TestCase):
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
- self.source = file(inspect.getsourcefile(self.fodderFile)).read()
+ with open(inspect.getsourcefile(self.fodderFile)) as fp:
+ self.source = fp.read()
def sourcerange(self, top, bottom):
lines = self.source.split("\n")