mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
close files properly
This commit is contained in:
parent
9f5f65c736
commit
807a5a1652
1 changed files with 2 additions and 0 deletions
|
@ -182,10 +182,12 @@ class CgiTests(unittest.TestCase):
|
||||||
return a
|
return a
|
||||||
|
|
||||||
f = TestReadlineFile(tempfile.TemporaryFile("w+"))
|
f = TestReadlineFile(tempfile.TemporaryFile("w+"))
|
||||||
|
self.addCleanup(f.close)
|
||||||
f.write('x' * 256 * 1024)
|
f.write('x' * 256 * 1024)
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
env = {'REQUEST_METHOD':'PUT'}
|
env = {'REQUEST_METHOD':'PUT'}
|
||||||
fs = cgi.FieldStorage(fp=f, environ=env)
|
fs = cgi.FieldStorage(fp=f, environ=env)
|
||||||
|
self.addCleanup(fs.file.close)
|
||||||
# if we're not chunking properly, readline is only called twice
|
# if we're not chunking properly, readline is only called twice
|
||||||
# (by read_binary); if we are chunking properly, it will be called 5 times
|
# (by read_binary); if we are chunking properly, it will be called 5 times
|
||||||
# as long as the chunksize is 1 << 16.
|
# as long as the chunksize is 1 << 16.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue