diff options
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r-- | Lib/test/test_inspect.py | 3 |
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") |