shithub: aubio

Download patch

ref: cea30b8952f7aa2d7f5c4c8b27f34f1ee1fb5053
parent: d1ec8cbc0938fb759c0c393040ab5e5202386cca
author: Paul Brossier <piem@piem.org>
date: Thu Nov 1 11:14:29 EDT 2007

aubioclass.py: make sndfile raise error if file not opened, do not delete it if == None, avoiding several segfaults

--- a/python/aubio/aubioclass.py
+++ b/python/aubio/aubioclass.py
@@ -42,8 +42,9 @@
             self.file = new_aubio_sndfile_wo(model.file,filename)
         else:
             self.file = new_aubio_sndfile_ro(filename)
+        if self.file == None: raise(ValueError, "failed opening file")
     def __del__(self):
-        del_aubio_sndfile(self.file)
+        if self.file != None: del_aubio_sndfile(self.file)
     def info(self):
         aubio_sndfile_info(self.file)
     def samplerate(self):