# HG changeset patch # User FUJIWARA Katsunori # Date 1403191279 -32400 # Node ID dfb8f757750cf75abb2bb1e27514f8c43b66d893 # Parent 9aaffb22d7d7e59d5079368536011a17bc2804de subrepo: ensure "close()" execution at the end of "_readstorehashcache()" Before this patch, "close()" for the file object opened in "_readstorehashcache()" may not be executed, if unexpected exception is raised, because it isn't executed in "finally" clause. This patch ensures "close()" execution at the end of "_readstorehashcache()" by moving it into "finally" clause. diff -r 9aaffb22d7d7 -r dfb8f757750c mercurial/subrepo.py --- a/mercurial/subrepo.py Fri Jun 20 00:21:19 2014 +0900 +++ b/mercurial/subrepo.py Fri Jun 20 00:21:19 2014 +0900 @@ -576,8 +576,10 @@ if not os.path.exists(cachefile): return '' fd = open(cachefile, 'r') - pullstate = fd.readlines() - fd.close() + try: + pullstate = fd.readlines() + finally: + fd.close() return pullstate def _cachestorehash(self, remotepath):