From e80fa7f53aa6211db7d4334f53b0af8b3cfad711 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 29 Jan 2010 18:45:41 +0000 Subject: Handle AttributeError inside atomic_ofstream.__del__. Thanks to Cardoe for reporting. (trunk r15168) svn path=/main/branches/2.1.7/; revision=15236 --- pym/portage/util.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pym/portage/util.py b/pym/portage/util.py index bb53b0785..ad2b8b9fe 100644 --- a/pym/portage/util.py +++ b/pym/portage/util.py @@ -1009,9 +1009,13 @@ class atomic_ofstream(ObjectProxy): def __del__(self): """If the user does not explicitely call close(), it is assumed that an error has occurred, so we abort().""" - f = object.__getattribute__(self, '_file') - if not f.closed: - self.abort() + try: + f = object.__getattribute__(self, '_file') + except AttributeError: + pass + else: + if not f.closed: + self.abort() # ensure destructor from the base class is called base_destructor = getattr(ObjectProxy, '__del__', None) if base_destructor is not None: -- cgit v1.2.3-1-g7c22