if type(f) == type(''):
import builtins
f = builtins.open(f, 'rb')
+ self._opened = True
+ else:
+ self._opened = False
self.initfp(f)
def __del__(self):
self._soundpos = pos
def close(self):
+ if self._opened and self._file:
+ self._file.close()
self._file = None
class Au_write:
if type(f) == type(''):
import builtins
f = builtins.open(f, 'wb')
+ self._opened = True
+ else:
+ self._opened = False
self.initfp(f)
def __del__(self):
if self._file:
self.close()
+ self._file = None
def initfp(self, file):
self._file = file
self._datalength != self._datawritten:
self._patchheader()
self._file.flush()
+ if self._opened and self._file:
+ self._file.close()
self._file = None
#
Library
-------
+- Issue #10265: Close file objects explicitly in sunau. Patch by Brian Brazil.
+
- Issue #10266: uu.decode didn't close in_file explicitly when it was given
as a filename. Patch by Brian Brazil.