[Python-checkins] r54394 - in python/trunk: Lib/wave.py Misc/NEWS

Georg Brandl g.brandl at gmx.net
Thu Mar 15 08:54:21 CET 2007


Raymond Hettinger schrieb:
>> -        self.initfp(f)
>> +        try:
>> +            self.initfp(f)
>> +        except:
>> +            if self._i_opened_the_file:
>> +                f.close()
>> +            raise
> 
> Do you really want a bare except?
> Would a try/finally approach work here?

The file shouldn't be closed if there was no exception,
but the except could probably be narrowed to wave.Error and EOFError.

Georg



More information about the Python-checkins mailing list