[Python-checkins] r54396 - python/branches/release25-maint/Lib/wave.py
georg.brandl
python-checkins at python.org
Thu Mar 15 08:43:22 CET 2007
Author: georg.brandl
Date: Thu Mar 15 08:43:22 2007
New Revision: 54396
Modified:
python/branches/release25-maint/Lib/wave.py
Log:
Also commit the patch ;)
Modified: python/branches/release25-maint/Lib/wave.py
==============================================================================
--- python/branches/release25-maint/Lib/wave.py (original)
+++ python/branches/release25-maint/Lib/wave.py Thu Mar 15 08:43:22 2007
@@ -159,7 +159,12 @@
f = __builtin__.open(f, 'rb')
self._i_opened_the_file = f
# else, assume it is an open file object already
- self.initfp(f)
+ try:
+ self.initfp(f)
+ except:
+ if self._i_opened_the_file:
+ f.close()
+ raise
def __del__(self):
self.close()
@@ -297,7 +302,12 @@
if isinstance(f, basestring):
f = __builtin__.open(f, 'wb')
self._i_opened_the_file = f
- self.initfp(f)
+ try:
+ self.initfp(f)
+ except:
+ if self._i_opened_the_file:
+ f.close()
+ raise
def initfp(self, file):
self._file = file
More information about the Python-checkins
mailing list