shithub: aubio

Download patch

ref: ca9d5aafe57a62ee10a1a8fcbe29927464a8371c
parent: c9e28072f63e496336c25f978307aebd773d995f
author: Paul Brossier <piem@piem.org>
date: Wed Dec 19 12:09:09 EST 2018

[py] use PyFloat_FromDouble in meltohz methods

For some reason this bug is only triggered with osx native python2.7.

--- a/python/ext/py-musicutils.c
+++ b/python/ext/py-musicutils.c
@@ -194,9 +194,9 @@
     return NULL;
   }
   if (htk != NULL && PyObject_IsTrue(htk) == 1)
-    return Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_hztomel_htk(v));
+    return PyFloat_FromDouble(aubio_hztomel_htk(v));
   else
-    return Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_hztomel(v));
+    return PyFloat_FromDouble(aubio_hztomel(v));
 }
 
 PyObject*
@@ -211,9 +211,9 @@
     return NULL;
   }
   if (htk != NULL && PyObject_IsTrue(htk) == 1)
-    return Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_meltohz_htk(v));
+    return PyFloat_FromDouble(aubio_meltohz_htk(v));
   else
-    return Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_meltohz(v));
+    return PyFloat_FromDouble(aubio_meltohz(v));
 }
 
 PyObject*
@@ -223,7 +223,7 @@
   if (!PyArg_ParseTuple(args, AUBIO_NPY_SMPL_CHR, &v)) {
     return NULL;
   }
-  return Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_hztomel_htk(v));
+  return PyFloat_FromDouble(aubio_hztomel_htk(v));
 }
 
 PyObject*
@@ -233,5 +233,5 @@
   if (!PyArg_ParseTuple(args, AUBIO_NPY_SMPL_CHR, &v)) {
     return NULL;
   }
-  return Py_BuildValue(AUBIO_NPY_SMPL_CHR, aubio_meltohz_htk(v));
+  return PyFloat_FromDouble(aubio_meltohz_htk(v));
 }