diff --git a/library/forms/swig/cairo.i b/library/forms/swig/cairo.i
index a02efdc..8305498 100644
--- a/library/forms/swig/cairo.i
+++ b/library/forms/swig/cairo.i
@@ -125,20 +125,20 @@
 
 %typemap(argout) cairo_text_extents_t *extents {
       PyObject *o= SWIG_NewPointerObj(new cairo_text_extents_t(*$1), SWIGTYPE_p_cairo_text_extents_t, 0 |  0 );
-      $result= SWIG_Python_AppendOutput($result, o);
+      $result= SWIG_AppendOutput($result, o);
 }
 
 %typemap(in) const char* (std::string s) {
   if (PyUnicode_Check($input))
   {
     PyObject *tmp = PyUnicode_AsUTF8String($input);
-    s = PyString_AsString(tmp);
+    s = PyBytes_AsString(tmp);
     $1 = (char*)s.c_str();
     Py_DECREF(tmp); 
   } 
-  else if (PyString_Check($input)) 
+  else if (PyBytes_Check($input))
   {
-    s = PyString_AsString($input); 
+    s = PyBytes_AsString($input);
     $1 = (char*)s.c_str();
   }
   else 
@@ -158,7 +158,7 @@
         for (int c= PyList_Size($input), i= 0; i < c; i++)
         {
             PyObject *item = PyList_GetItem($input, i);
-            if (PyFloat_Check(item)) 
+            if (PyFloat_Check(item))
                 $1[i] = PyFloat_AsDouble(item);
             else
             {
@@ -182,4 +182,3 @@ cairo_surface_t *cairo_image_surface_create_from_png_stream(PyObject *reader)
 {
   return cairo_image_surface_create_from_png_stream(py_read_func, reader);
 }
-
diff --git a/library/forms/swig/mforms.i b/library/forms/swig/mforms.i
index ac4c6e3..7426315 100644
--- a/library/forms/swig/mforms.i
+++ b/library/forms/swig/mforms.i
@@ -137,7 +137,7 @@ static void show_python_exception()
   std::string result;
 
   /* See if we can get a full traceback */
-  moduleName = PyString_FromString("traceback");
+  moduleName = PyUnicode_FromString("traceback");
   pythonModule = PyImport_Import(moduleName);
   Py_DECREF(moduleName);
 
@@ -606,11 +606,11 @@ inline boost::function<void (mforms::TextEntryAction)> pycall_void_entryaction_f
   if (PyUnicode_Check($input))
   {
     PyObject *tmp = PyUnicode_AsUTF8String($input);
-    $1 = new std::string(PyString_AsString(tmp));
+    $1 = new std::string(PyBytes_AsString(tmp));
     Py_DECREF(tmp);
   }
-  else if (PyString_Check($input))
-    $1 = new std::string(PyString_AsString($input));
+  else if (PyBytes_Check($input))
+    $1 = new std::string(PyBytes_AsString($input));
   else
   {
     PyErr_SetString(PyExc_TypeError, "not a string");
@@ -635,11 +635,11 @@ inline boost::function<void (mforms::TextEntryAction)> pycall_void_entryaction_f
       if (PyUnicode_Check(item))
       {
         PyObject *tmp = PyUnicode_AsUTF8String(item);
-        $1->push_back(PyString_AsString(tmp));
+        $1->push_back(PyBytes_AsString(tmp));
         Py_DECREF(tmp);
       }
-      else if (PyString_Check(item))
-        $1->push_back(PyString_AsString(item));
+      else if (PyBytes_Check(item))
+        $1->push_back(PyBytes_AsString(item));
       else
       {
         delete $1;
@@ -656,7 +656,7 @@ inline boost::function<void (mforms::TextEntryAction)> pycall_void_entryaction_f
    $result = PyList_New(0);
    for (std::vector<int>::const_iterator iter = $1.begin(); iter != $1.end(); ++iter)
    {
-     PyList_Append($result, PyInt_FromLong(*iter));
+     PyList_Append($result, PyLong_FromLong(*iter));
    }
 }
 
@@ -664,7 +664,7 @@ inline boost::function<void (mforms::TextEntryAction)> pycall_void_entryaction_f
    $result = PyList_New(0);
    for (std::vector<size_t>::const_iterator iter = $1.begin(); iter != $1.end(); ++iter)
    {
-     PyList_Append($result, PyInt_FromLong(*iter));
+     PyList_Append($result, PyLong_FromLong(*iter));
    }
 }
 
@@ -674,7 +674,7 @@ inline boost::function<void (mforms::TextEntryAction)> pycall_void_entryaction_f
     for (int c= PyList_Size($input), i= 0; i < c; i++)
     {
       PyObject *item = PyList_GetItem($input, i);
-      $1->push_back(PyInt_AsLong(item));
+      $1->push_back(PyLong_AsLong(item));
     }
   }
   else
@@ -698,11 +698,11 @@ inline boost::function<void (mforms::TextEntryAction)> pycall_void_entryaction_f
       if (PyUnicode_Check(item))
       {
         PyObject *tmp = PyUnicode_AsUTF8String(item);
-        $1->push_back(PyString_AsString(tmp));
+        $1->push_back(PyBytes_AsString(tmp));
         Py_DECREF(tmp);
       }
-      else if (PyString_Check(item))
-        $1->push_back(PyString_AsString(item));
+      else if (PyBytes_Check(item))
+        $1->push_back(PyBytes_AsString(item));
       else
       {
         delete $1;
@@ -722,7 +722,7 @@ inline boost::function<void (mforms::TextEntryAction)> pycall_void_entryaction_f
 
 %typemap(argout) std::string &ret_password {
     PyObject *o= PyUnicode_DecodeUTF8(($1)->data(), ($1)->size(), NULL);
-    $result= SWIG_Python_AppendOutput($result, o);
+    $result= SWIG_AppendOutput($result, o);
 }
 
 %typemap(in,numinputs=0) std::string &ret_password(std::string temp) {
@@ -731,7 +731,7 @@ inline boost::function<void (mforms::TextEntryAction)> pycall_void_entryaction_f
 
 %typemap(argout) std::string &ret_value {
     PyObject *o= PyUnicode_DecodeUTF8(($1)->data(), ($1)->size(), NULL);
-    $result= SWIG_Python_AppendOutput($result, o);
+    $result= SWIG_AppendOutput($result, o);
 }
 
 %typemap(in,numinputs=0) std::string &ret_value(std::string temp) {
@@ -741,7 +741,7 @@ inline boost::function<void (mforms::TextEntryAction)> pycall_void_entryaction_f
 
 %typemap(argout) bool &ret_store {
     if (*$1) Py_INCREF(Py_True); else Py_INCREF(Py_False);
-    $result= SWIG_Python_AppendOutput($result, *$1 ? Py_True : Py_False);
+    $result= SWIG_AppendOutput($result, *$1 ? Py_True : Py_False);
 }
 
 %typemap(in,numinputs=0) bool &ret_store(bool temp) {
@@ -821,8 +821,8 @@ namespace std {
       PyObject *item = PyList_GetItem($input, i);
       if (PyFloat_Check(item))
         $1.push_back(PyFloat_AsDouble(item));
-      else if (PyInt_Check(item))
-        $1.push_back(PyInt_AsLong(item));
+      else if (PyLong_Check(item))
+        $1.push_back(PyLong_AsLong(item));
       else
       {
         SWIG_exception_fail(SWIG_TypeError, "expected list of doubles");
diff --git a/library/forms/swig/mforms_drawbox.h b/library/forms/swig/mforms_drawbox.h
index e540c54..ae96951 100644
--- a/library/forms/swig/mforms_drawbox.h
+++ b/library/forms/swig/mforms_drawbox.h
@@ -164,7 +164,7 @@ namespace mforms {
          {
            PyObject *repr = PyObject_Repr(self);
            printf("Error calling method %s from PyDrawBox delegate %s\n", method,
-                  PyString_AsString(repr));
+                  PyBytes_AsString(repr));
            Py_DECREF(repr);
          }*/
       }
