From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RyaiY-0003V7-2f for garchives@archives.gentoo.org; Sat, 18 Feb 2012 03:12:10 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D94FDE097B; Sat, 18 Feb 2012 03:11:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 74875E0986 for ; Sat, 18 Feb 2012 03:11:59 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C8EC21B4017 for ; Sat, 18 Feb 2012 03:11:58 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 88451E5404 for ; Sat, 18 Feb 2012 03:11:57 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1329534678.557134066e5a8e4a1b0522fe94d931a2688f98f7.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/util/mtimedb.py X-VCS-Directories: pym/portage/util/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 557134066e5a8e4a1b0522fe94d931a2688f98f7 X-VCS-Branch: master Date: Sat, 18 Feb 2012 03:11:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 1375feee-d06e-48ac-853a-0a82896ec67b X-Archives-Hash: e5b1a97eb255eeeacdfd61c4ed84fcfd commit: 557134066e5a8e4a1b0522fe94d931a2688f98f7 Author: Zac Medico gentoo org> AuthorDate: Sat Feb 18 02:41:27 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Feb 18 03:11:18 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D55713406 MtimeDB._load: explicitly close file --- pym/portage/util/mtimedb.py | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pym/portage/util/mtimedb.py b/pym/portage/util/mtimedb.py index 8079aa9..0a27166 100644 --- a/pym/portage/util/mtimedb.py +++ b/pym/portage/util/mtimedb.py @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Gentoo Foundation +# Copyright 2010-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 __all__ =3D ['MtimeDB'] @@ -23,6 +23,7 @@ class MtimeDB(dict): self._load(filename) =20 def _load(self, filename): + f =3D None try: f =3D open(_unicode_encode(filename), 'rb') mypickle =3D pickle.Unpickler(f) @@ -32,8 +33,6 @@ class MtimeDB(dict): # TODO: If py3k, override Unpickler.find_class(). pass d =3D mypickle.load() - f.close() - del f except (AttributeError, EOFError, EnvironmentError, ValueError, pickle= .UnpicklingError) as e: if isinstance(e, EnvironmentError) and \ getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES): @@ -43,6 +42,9 @@ class MtimeDB(dict): (filename, str(e)), noiselevel=3D-1) del e d =3D {} + finally: + if f is not None: + f.close() =20 if "old" in d: d["updates"] =3D d["old"]