Cache attempt to close file

Attempt to close the file passed to the get callback function.  Closing
is the right thing to do, but it is possible that the user will close it
before returning..
This commit is contained in:
Bryan Schumaker 2010-10-25 09:08:14 -04:00
parent d46eca4823
commit b69e790186
1 changed files with 4 additions and 0 deletions

View File

@ -21,6 +21,10 @@ class CacheObject:
f = open(path, 'w')
if func(f, *args):
return path
try:
f.close()
except:
pass
else:
return path