1 |
Author: zmedico |
2 |
Date: 2010-01-05 19:02:44 +0000 (Tue, 05 Jan 2010) |
3 |
New Revision: 15168 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/util.py |
7 |
Log: |
8 |
Handle AttributeError inside atomic_ofstream.__del__. Thanks to Cardoe for |
9 |
reporting. |
10 |
|
11 |
|
12 |
Modified: main/trunk/pym/portage/util.py |
13 |
=================================================================== |
14 |
--- main/trunk/pym/portage/util.py 2010-01-05 16:01:36 UTC (rev 15167) |
15 |
+++ main/trunk/pym/portage/util.py 2010-01-05 19:02:44 UTC (rev 15168) |
16 |
@@ -1009,9 +1009,13 @@ |
17 |
def __del__(self): |
18 |
"""If the user does not explicitely call close(), it is |
19 |
assumed that an error has occurred, so we abort().""" |
20 |
- f = object.__getattribute__(self, '_file') |
21 |
- if not f.closed: |
22 |
- self.abort() |
23 |
+ try: |
24 |
+ f = object.__getattribute__(self, '_file') |
25 |
+ except AttributeError: |
26 |
+ pass |
27 |
+ else: |
28 |
+ if not f.closed: |
29 |
+ self.abort() |
30 |
# ensure destructor from the base class is called |
31 |
base_destructor = getattr(ObjectProxy, '__del__', None) |
32 |
if base_destructor is not None: |