diff --git a/plugins/plugin_python.c b/plugins/plugin_python.c
index e725ad8..196b825 100644
--- a/plugins/plugin_python.c
+++ b/plugins/plugin_python.c
@@ -81,7 +81,7 @@ int TEP_PLUGIN_LOADER(struct tep_handle *pevent)
 	} else
 		Py_DECREF(res);
 
-	str = PyString_FromString("pevent");
+	str = PyUnicode_FromString("pevent");
 	if (!str)
 		return -ENOMEM;
 
diff --git a/python/ctracecmd.i b/python/ctracecmd.i
index 2601d39..01cd0d5 100644
--- a/python/ctracecmd.i
+++ b/python/ctracecmd.i
@@ -16,6 +16,7 @@
 %{
 #include "trace-cmd.h"
 #include "event-utils.h"
+#include <Python.h>
 %}
 
 
diff --git a/python/ctracecmdgui.i b/python/ctracecmdgui.i
index 1dcdab0..8ca38f7 100644
--- a/python/ctracecmdgui.i
+++ b/python/ctracecmdgui.i
@@ -7,6 +7,7 @@
 #include <pygobject.h>
 #include <pyglib.h>
 #include <Python.h>
+#include <memoryobject.h>
 
 extern GtkTreeModel *trace_view_store_as_gtk_tree_model(struct trace_view_store *store);
 
@@ -37,10 +38,10 @@ pytype_from_gtype(GType gtype)
 
 /* help swig cope with g* types */
 %typemap(in) gint {
-    $1 = PyInt_AsLong($input);
+    $1 = PyLong_AsLong($input);
 }
 %typemap(out) gint {
-    $result = PyInt_FromLong($1);
+    $result = PyLong_FromLong($1);
 }
 %typemap(in) guint {
     $1 = PyLong_AsUnsignedLong($input);
