python/lib/gen_code.py: make sure aubio object has been created before deleting it
authorPaul Brossier <piem@piem.org>
Wed, 4 May 2016 11:16:44 +0000 (13:16 +0200)
committerPaul Brossier <piem@piem.org>
Wed, 4 May 2016 11:16:44 +0000 (13:16 +0200)
python/lib/gen_code.py

index 3d16877..6fc8e2a 100644 (file)
@@ -353,7 +353,9 @@ Py_{shortname}_del  (Py_{shortname} * self, PyObject * unused)
     {del_out}(self->{name});""".format(del_out = del_out, name = name)
         del_fn = get_name(self.del_proto)
         out += """
-    {del_fn}(self->o);
+    if (self->o) {{
+        {del_fn}(self->o);
+    }}
     Py_TYPE(self)->tp_free((PyObject *) self);
 }}
 """.format(del_fn = del_fn)