summaryrefslogtreecommitdiffstats
path: root/Lib/sunau.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/sunau.py')
-rw-r--r--Lib/sunau.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/sunau.py b/Lib/sunau.py
index 3da41b7..e760093 100644
--- a/Lib/sunau.py
+++ b/Lib/sunau.py
@@ -295,9 +295,11 @@ class Au_read:
self._soundpos = pos
def close(self):
- if self._opened and self._file:
- self._file.close()
- self._file = None
+ file = self._file
+ if file:
+ self._file = None
+ if self._opened:
+ file.close()
class Au_write:
@@ -438,9 +440,10 @@ class Au_write:
self._patchheader()
self._file.flush()
finally:
- if self._opened and self._file:
- self._file.close()
+ file = self._file
self._file = None
+ if self._opened:
+ file.close()
#
# private methods