From: Stefan Behnel Date: Tue, 2 Nov 2010 17:16:30 +0000 (+0100) Subject: fix test runner warning in Python 3.2 debug builds X-Git-Tag: 0.14.alpha0~257 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=fa91d0627d4886448d0c6bd6746dbb904cc9bd58;p=cython.git fix test runner warning in Python 3.2 debug builds --- diff --git a/runtests.py b/runtests.py index 1063d5fb..bb4937c4 100644 --- a/runtests.py +++ b/runtests.py @@ -763,10 +763,14 @@ class FileListExcluder: def __init__(self, list_file): self.excludes = {} - for line in open(list_file).readlines(): - line = line.strip() - if line and line[0] != '#': - self.excludes[line.split()[0]] = True + f = open(list_file) + try: + for line in f.readlines(): + line = line.strip() + if line and line[0] != '#': + self.excludes[line.split()[0]] = True + finally: + f.close() def __call__(self, testname): return testname in self.excludes or testname.split('.')[-1] in self.excludes