From: Zac Medico Date: Fri, 22 Sep 2006 22:31:33 +0000 (-0000) Subject: Move the open call out of the inner try block. X-Git-Tag: v2.1.1-r1~30 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f3343814356566b7738eba2976787e6181598f25;p=portage.git Move the open call out of the inner try block. svn path=/main/trunk/; revision=4506 --- diff --git a/pym/cache/flat_hash.py b/pym/cache/flat_hash.py index 90c785f34..1c687ecf3 100644 --- a/pym/cache/flat_hash.py +++ b/pym/cache/flat_hash.py @@ -23,15 +23,13 @@ class database(fs_template.FsBased): def __getitem__(self, cpv): fp = os.path.join(self.location, cpv) try: - myf = None + myf = open(fp, "r") try: - myf = open(fp,"r") d = self._parse_data(myf, cpv) d["_mtime_"] = long(os.fstat(myf.fileno()).st_mtime) return d finally: - if myf: - myf.close() + myf.close() except (IOError, OSError), e: if e.errno != errno.ENOENT: raise cache_errors.CacheCorruption(cpv, e)