From b69e790186c0caf2344ade7db90683b45277ce10 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Mon, 25 Oct 2010 09:08:14 -0400 Subject: [PATCH] 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.. --- libsaria/cache.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libsaria/cache.py b/libsaria/cache.py index 6e4f1936..dcf2ad49 100644 --- a/libsaria/cache.py +++ b/libsaria/cache.py @@ -21,6 +21,10 @@ class CacheObject: f = open(path, 'w') if func(f, *args): return path + try: + f.close() + except: + pass else: return path