summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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: