Index: python/ext/aubiowraphell.h
===================================================================
--- python/ext/aubiowraphell.h	(revision 2e4ae1df05117da3dbe3793d2289116bf11a9a4c)
+++ python/ext/aubiowraphell.h	(revision 5c1200a07d442662cc3279233173686679737953)
@@ -44,6 +44,5 @@
 #define AUBIO_TYPEOBJECT(NAME, PYNAME) \
 PyTypeObject Py_ ## NAME ## Type = { \
-  PyObject_HEAD_INIT (NULL)    \
-  0,                           \
+  PyVarObject_HEAD_INIT (NULL, 0) \
   PYNAME,                      \
   sizeof (Py_ ## NAME),          \
Index: python/ext/py-cvec.c
===================================================================
--- python/ext/py-cvec.c	(revision 2e4ae1df05117da3dbe3793d2289116bf11a9a4c)
+++ python/ext/py-cvec.c	(revision 5c1200a07d442662cc3279233173686679737953)
@@ -70,5 +70,5 @@
   PyObject *result = NULL;
 
-  format = PyString_FromString ("aubio cvec of %d elements");
+  format = PyUnicode_FromString ("aubio cvec of %d elements");
   if (format == NULL) {
     goto fail;
@@ -81,5 +81,5 @@
   cvec_print ( self->o );
 
-  result = PyString_Format (format, args);
+  result = PyUnicode_Format (format, args);
 
 fail:
@@ -261,6 +261,5 @@
 
 PyTypeObject Py_cvecType = {
-  PyObject_HEAD_INIT (NULL)
-  0,                            /* ob_size           */
+  PyVarObject_HEAD_INIT(NULL, 0)
   "aubio.cvec",                 /* tp_name           */
   sizeof (Py_cvec),             /* tp_basicsize      */
Index: python/ext/py-fft.c
===================================================================
--- python/ext/py-fft.c	(revision 2e4ae1df05117da3dbe3793d2289116bf11a9a4c)
+++ python/ext/py-fft.c	(revision 5c1200a07d442662cc3279233173686679737953)
@@ -51,5 +51,5 @@
     char_t errstr[30];
     sprintf(errstr, "error creating fft with win_s=%d", self->win_s);
-    PyErr_SetString (PyExc_StandardError, errstr);
+    PyErr_SetString (PyExc_Exception, errstr);
     return -1;
   }
@@ -66,5 +66,5 @@
   del_cvec(self->out);
   del_fvec(self->rout);
-  self->ob_type->tp_free((PyObject *) self);
+  Py_TYPE(self)->tp_free((PyObject *) self);
 }
 
Index: python/ext/py-filter.c
===================================================================
--- python/ext/py-filter.c	(revision 2e4ae1df05117da3dbe3793d2289116bf11a9a4c)
+++ python/ext/py-filter.c	(revision 5c1200a07d442662cc3279233173686679737953)
@@ -163,6 +163,5 @@
 
 PyTypeObject Py_filterType = {
-  PyObject_HEAD_INIT (NULL)
-  0,                            /* ob_size           */
+  PyVarObject_HEAD_INIT(NULL, 0)
   "aubio.digital_filter",       /* tp_name           */
   sizeof (Py_filter),           /* tp_basicsize      */
Index: python/ext/py-filterbank.c
===================================================================
--- python/ext/py-filterbank.c	(revision 2e4ae1df05117da3dbe3793d2289116bf11a9a4c)
+++ python/ext/py-filterbank.c	(revision 5c1200a07d442662cc3279233173686679737953)
@@ -60,5 +60,5 @@
     sprintf(errstr, "error creating filterbank with n_filters=%d, win_s=%d",
         self->n_filters, self->win_s);
-    PyErr_SetString (PyExc_StandardError, errstr);
+    PyErr_SetString (PyExc_RuntimeError, errstr);
     return -1;
   }
@@ -73,5 +73,5 @@
   del_aubio_filterbank(self->o);
   del_fvec(self->out);
-  self->ob_type->tp_free((PyObject *) self);
+  Py_TYPE(self)->tp_free((PyObject *) self);
 }
 
Index: python/ext/py-phasevoc.c
===================================================================
--- python/ext/py-phasevoc.c	(revision 2e4ae1df05117da3dbe3793d2289116bf11a9a4c)
+++ python/ext/py-phasevoc.c	(revision 5c1200a07d442662cc3279233173686679737953)
@@ -71,5 +71,5 @@
   del_cvec(self->output);
   del_fvec(self->routput);
-  self->ob_type->tp_free((PyObject *) self);
+  Py_TYPE(self)->tp_free((PyObject *) self);
 }
 
Index: python/ext/py-source.c
===================================================================
--- python/ext/py-source.c	(revision 2e4ae1df05117da3dbe3793d2289116bf11a9a4c)
+++ python/ext/py-source.c	(revision 5c1200a07d442662cc3279233173686679737953)
@@ -160,5 +160,5 @@
   del_fvec(self->read_to);
   del_fmat(self->mread_to);
-  self->ob_type->tp_free((PyObject *) self);
+  Py_TYPE(self)->tp_free((PyObject *) self);
 }
 
@@ -187,5 +187,5 @@
   PyObject *outputs = PyList_New(0);
   PyList_Append( outputs, (PyObject *)PyAubio_CFvecToArray (self->read_to));
-  PyList_Append( outputs, (PyObject *)PyInt_FromLong (read));
+  PyList_Append( outputs, (PyObject *)PyLong_FromLong(read));
   return outputs;
 }
@@ -214,5 +214,5 @@
   PyObject *outputs = PyList_New(0);
   PyList_Append( outputs, (PyObject *)PyAubio_CFmatToArray (self->mread_to));
-  PyList_Append( outputs, (PyObject *)PyInt_FromLong (read));
+  PyList_Append( outputs, (PyObject *)PyLong_FromLong(read));
   return outputs;
 }
@@ -234,5 +234,5 @@
 {
   uint_t tmp = aubio_source_get_samplerate (self->o);
-  return (PyObject *)PyInt_FromLong (tmp);
+  return (PyObject *)PyLong_FromLong (tmp);
 }
 
@@ -241,5 +241,5 @@
 {
   uint_t tmp = aubio_source_get_channels (self->o);
-  return (PyObject *)PyInt_FromLong (tmp);
+  return (PyObject *)PyLong_FromLong (tmp);
 }
 
