]> granicus.if.org Git - python/commitdiff
Close the file after tokenizing it. Because the open file object was
authorTim Peters <tim.peters@gmail.com>
Mon, 12 May 2003 19:29:36 +0000 (19:29 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 12 May 2003 19:29:36 +0000 (19:29 +0000)
bound to a module global, the file object remained opened throughout
the test suite run.

Lib/test/test_tokenize.py

index e3fbb15f869bec52b961fade38a18b71011448d6..22a1d90afb00bec0cf19c50a070858e2cb857e9b 100644 (file)
@@ -3,7 +3,10 @@ import tokenize, os, sys
 
 if verbose:
     print 'starting...'
-file = open(findfile('tokenize_tests'+os.extsep+'py'))
-tokenize.tokenize(file.readline)
+
+f = file(findfile('tokenize_tests'+os.extsep+'py'))
+tokenize.tokenize(f.readline)
+f.close()
+
 if verbose:
     print 'finished'