summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-01-05 19:02:44 +0000
committerZac Medico <zmedico@gentoo.org>2010-01-05 19:02:44 +0000
commitb815dd042bf625313a4a45724d9213260d30870d (patch)
treebe29e614ffb888a246bcb4fc0a9e0135ccceafb3
parent25de25bf6c2550c2f00de46c62afaa83decf68ef (diff)
downloadportage-b815dd042bf625313a4a45724d9213260d30870d.tar.gz
portage-b815dd042bf625313a4a45724d9213260d30870d.tar.bz2
portage-b815dd042bf625313a4a45724d9213260d30870d.zip
Handle AttributeError inside atomic_ofstream.__del__. Thanks to Cardoe for
reporting. svn path=/main/trunk/; revision=15168
-rw-r--r--pym/portage/util.py10
1 files 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: