Fix C-API usage for Python 3. Closes #29

This commit is contained in:
Lars Immisch
2017-02-24 13:25:36 +01:00
parent dc51fa75b5
commit f19d139f64

View File

@@ -20,6 +20,11 @@
#define PyLong_Check PyInt_Check
#define PyLong_AS_LONG PyInt_AS_LONG
#endif
#if PY_MAJOR_VERSION < 3
#define PyLong_FromLong PyInt_FromLong
#endif
#include <alsa/asoundlib.h>
#include <alsa/version.h>
#include <stdio.h>
@@ -187,7 +192,7 @@ alsacard_list_indexes(PyObject *self, PyObject *args)
for (rc = snd_card_next(&card); !rc && (card >= 0);
rc = snd_card_next(&card))
{
PyObject *item = PyInt_FromLong(card);
PyObject *item = PyLong_FromLong(card);
PyList_Append(result, item);
Py_DECREF(item);