Merge commit '8245277ad3acd9308ce28c40508b999e9496b27e' into c99-complex

* commit '8245277ad3acd9308ce28c40508b999e9496b27e':
  Remove test for unsupported complex or _Complex by itself
  More C99 complex fixes, plus Python tests
  Restore _Complex as standalone type
  Small corrections for handling C99 _Complex
  Properly handle C99 complex types even in C++ mode

Conflicts:
	Examples/test-suite/python/complextest_runme.py
diff --git a/.travis.yml b/.travis.yml
index b806c85..43936b5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -219,6 +219,11 @@
       dist: xenial
     - compiler: gcc
       os: linux
+      env: SWIGLANG=python PY3=3 VER=3.9
+      sudo: required
+      dist: xenial
+    - compiler: gcc
+      os: linux
       env: SWIGLANG=python SWIG_FEATURES=-builtin
       sudo: required
       dist: xenial
@@ -232,7 +237,7 @@
       sudo: required
       dist: xenial
     - os: linux
-      env: SWIGLANG=python SWIG_FEATURES=-builtin GCC=6 CPP11=1 PY3=3 VER=3.8
+      env: SWIGLANG=python SWIG_FEATURES=-builtin GCC=6 CPP11=1 PY3=3 VER=3.9
       sudo: required
       dist: xenial
     - compiler: gcc
@@ -257,12 +262,17 @@
       dist: xenial
     - compiler: gcc
       os: linux
-      env: SWIGLANG=python SWIG_FEATURES="-builtin -O" PY3=3 VER=3.8
+      env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.9
       sudo: required
       dist: xenial
     - compiler: gcc
       os: linux
-      env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.8 SWIGOPTPY3=
+      env: SWIGLANG=python SWIG_FEATURES="-builtin -O" PY3=3 VER=3.9
+      sudo: required
+      dist: xenial
+    - compiler: gcc
+      os: linux
+      env: SWIGLANG=python SWIG_FEATURES=-builtin PY3=3 VER=3.9 SWIGOPTPY3=
       sudo: required
       dist: xenial
     - compiler: gcc
@@ -272,7 +282,7 @@
       dist: xenial
     - compiler: gcc
       os: linux
-      env: SWIGLANG=python SWIG_FEATURES=-O PY3=3 VER=3.8
+      env: SWIGLANG=python SWIG_FEATURES=-O PY3=3 VER=3.9
       sudo: required
       dist: xenial
     - compiler: gcc
@@ -404,7 +414,7 @@
       sudo: required
       dist: xenial
     - os: linux
-      env: SWIGLANG=python GCC=8 CPP17=1 PY3=3 VER=3.8
+      env: SWIGLANG=python GCC=8 CPP17=1 PY3=3 VER=3.9
       sudo: required
       dist: xenial
     - os: linux
@@ -416,7 +426,7 @@
       sudo: required
       dist: xenial
     - os: linux
-      env: SWIGLANG=python GCC=9 CPP17=1 PY3=3 VER=3.8
+      env: SWIGLANG=python GCC=9 CPP17=1 PY3=3 VER=3.9
       sudo: required
       dist: xenial
     - os: linux
diff --git a/CHANGES.current b/CHANGES.current
index 0118609..63548c6 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -7,6 +7,55 @@
 Version 4.1.0 (in progress)
 ===========================
 
+2020-10-07: treitmayr
+            [Python] #1812 Fix error handling in pybuffer.i PyObject_GetBuffer().
+
+2020-10-07: treitmayr
+            #1824 Add missing space in director method declaration returning
+            const pointer.
+
+2020-10-07: adelva1984
+            #1859 Remove all (two) exceptions from SWIG executable.
+
+2020-09-25: wsfulton
+            [C#, Java] #1874 Add ability to change the modifiers for the interface
+            generated when using the %interface macros.
+
+            For C# use the 'csinterfacemodifiers' typemap.
+            For Java use the 'javainterfacemodifiers' typemap.
+
+            For example:
+
+              %typemap(csinterfacemodifiers) X "internal interface"
+
+
+2020-09-24: geefr
+            [C#] #1868 Fix wchar_t* csvarout typemap for member variable wrappers.
+
+2020-08-28: wsfulton
+            [Java] #1862 Fix crashes in swig_connect_director during director class construction
+            when using the director class from multiple threads - a race condition initialising
+            block scope static variables. The fix is guaranteed when using C++11, but most
+            compilers also fix it when using C++03/C++98.
+
+2020-08-16: wsfulton
+            [Python] Add missing initializer for member ‘_heaptypeobject::ht_module’ when using
+            -builtin to complete Python 3.9 support.
+
+2020-08-16: wsfulton
+            [Python] Remove PyEval_InitThreads() call for Python 3.7 and later as Python calls
+            it automatically now. This removes a deprecation warning when using Python 3.9.
+
+2020-08-15: wsfulton
+            [Python] All Python examples and tests are written to be Python 2 and Python 3
+            compatible, removing the need for 2to3 to run the examples or test-suite.
+
+2020-08-13: wsfulton
+            [C#] Add support for void *VOID_INT_PTR for member variables.
+
+2020-07-29: chrisburr
+            #1843 [Python] Compilation error fix in SwigPyBuiltin_SetMetaType when using PyPy.
+
 2020-06-14: ZackerySpytz
             #1642 #1809 Fix virtual comparison operators in director classes - remove incorrect
             space in the function name, for example, operator= = is now operator==.
diff --git a/Doc/Manual/CSharp.html b/Doc/Manual/CSharp.html
index ef4c010..fe8f7c4 100644
--- a/Doc/Manual/CSharp.html
+++ b/Doc/Manual/CSharp.html
@@ -240,6 +240,7 @@
 javafinalize                -> csfinalize
 javadestruct                -> csdisposing and csdispose
 javadestruct_derived        -> csdisposing_derived and csdispose_derived
+javainterfacemodifiers      -> csinterfacemodifiers
 javainterfacecode           -> csinterfacecode
 </pre></div>
 
diff --git a/Doc/Manual/Java.html b/Doc/Manual/Java.html
index b9234b2..2f55f5b 100644
--- a/Doc/Manual/Java.html
+++ b/Doc/Manual/Java.html
@@ -6610,6 +6610,15 @@
 
 </div>
 
+<p><tt>%typemap(javainterfacemodifiers)</tt></p>
+<div class="indent">
+Interface modifiers for the Java interface generated when using the <tt>interface</tt> feature, see <a href="Java.html#Java_interfaces">Java interfaces</a> section. The default is "public interface".
+<p>
+<b>Compatibility note:</b> This typemap was added in SWIG-4.1.0.
+</p>
+
+</div>
+
 <p><tt>%typemap(javainterfacecode, declaration="...", cptrmethod="...")</tt></p>
 <div class="indent">
 <p>
@@ -6709,7 +6718,7 @@
 <div class="code">
 <pre>
 [ javaimports typemap ]
-public interface [ javainterfacename ] {
+[ javainterfacemodifiers typemap ] [ javainterfacename ] {
 [ javainterfacecode:cptrmethod typemap attribute ]
 ... interface declarations ...
 }
diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html
index 800e2e4..f6f0d16 100644
--- a/Doc/Manual/Windows.html
+++ b/Doc/Manual/Windows.html
@@ -77,10 +77,10 @@
 
 
 <p>
-Using Microsoft Visual C++ is the most common approach to compiling and linking SWIG's output. 
+Microsoft Visual C++ is the most commonly used compiler for compiling and linking SWIG's output on Windows.
 The Examples directory has a few Visual C++ project files (.dsp files). 
 These were produced by Visual C++ 6.
-Newer versions of Visual Studio should be able to open and convert these project files.
+Newer versions of Visual Studio are able to open and convert these project files.
 Each C# example comes with a Visual Studio 2005 solution and associated project files instead of Visual C++ 6 project files.
 The project files have been set up to execute SWIG in a custom build rule for the SWIG interface (.i) file. 
 Alternatively run the <a href="#Windows_examples_cygwin">examples using Cygwin</a>.
@@ -95,9 +95,11 @@
 Ensure the SWIG executable is as supplied in the SWIG root directory in order for the examples to work. 
 Most languages require some environment variables to be set <b>before</b> running Visual C++. 
 Note that Visual C++ must be re-started to pick up any changes in environment variables. 
-Open up an example .dsp file, Visual C++ will create a workspace for you (.dsw file). 
-Ensure the Release build is selected then do a Rebuild All from the Build menu.
-The required environment variables are displayed with their current values.
+Open up an example .dsp file, Visual C++ will prompt you to upgrade the project and convert
+it into an MSBuild project (.vcxproj file) and Solution (.sln file).
+Note that older versions of Visual C++ will simply create a workspace for you (.dsw file).
+Ensure the Release build is selected then do a Rebuild Solution from the Build menu.
+The required environment variables are displayed with their current values during the build.
 </p>
 <p>
 The list of required environment variables for each module language is also listed below.
@@ -111,7 +113,7 @@
 
 <p>
 The C# examples do not require any environment variables to be set as a C# project file is included.
-Just open up the .sln solution file in Visual Studio .NET 2003 or later, select Release Build, and do a Rebuild All from the Build menu.
+Just open up the .sln solution file in Visual Studio 2005 or later, select Release Build, and do a Rebuild Solution from the Build menu.
 The accompanying C# and C++ project files are automatically used by the solution file.
 </p>
 
diff --git a/Examples/Makefile.in b/Examples/Makefile.in
index 87386f7..3f6140b 100644
--- a/Examples/Makefile.in
+++ b/Examples/Makefile.in
@@ -381,13 +381,7 @@
 # Running a Python example
 # -----------------------------------------------------------------
 
-ifeq (,$(PY3))
-  PYSCRIPT = $(RUNME).py
-else
-  PYSCRIPT = $(RUNME)3.py
-endif
-
-PY2TO3 = @PY2TO3@ `@PY2TO3@ -l | grep -v -E "Available|import$$" | awk '{print "-f "$$0}'`
+PYSCRIPT = $(RUNME).py
 
 python_run: $(PYSCRIPT)
 ifneq (,$(PYCODESTYLE))
@@ -400,10 +394,6 @@
 	cp $< $@
 endif
 
-$(RUNME)3.py: $(SRCDIR)$(RUNME).py
-	cp $< $@
-	$(PY2TO3) -w $@ >/dev/null 2>&1
-
 # -----------------------------------------------------------------
 # Version display
 # -----------------------------------------------------------------
@@ -421,7 +411,6 @@
 	rm -f core @EXTRA_CLEAN@
 	rm -f *.@OBJEXT@ *@SO@ *$(PYTHON_SO)
 	rm -f $(TARGET).py
-	if test -f $(SRCDIR)$(RUNME).py; then rm -f $(RUNME)3.py $(RUNME)3.py.bak; fi
 	case "x$(SRCDIR)" in x|x./);; *) rm -f $(RUNME).py;; esac
 
 
diff --git a/Examples/contract/simple_c/example.c b/Examples/contract/simple_c/example.c
deleted file mode 100644
index 85a3e14..0000000
--- a/Examples/contract/simple_c/example.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <stdio.h>
-
-int Circle (int x, int y, int radius) {
-  /* Draw Circle */
-  printf("Drawing the circle...\n");
-  /* Return -1 to test contract post assertion */
-  if (radius == 2)
-    return -1;
-  else
-    return 1;
-}
diff --git a/Examples/contract/simple_c/example.i b/Examples/contract/simple_c/example.i
deleted file mode 100644
index 49df09a..0000000
--- a/Examples/contract/simple_c/example.i
+++ /dev/null
@@ -1,19 +0,0 @@
-/* File : example.i */
-
-/* Basic C example for swig contract */
-/* Tiger, University of Chicago, 2003 */
-
-%module example
-
-%contract Circle (int x, int y, int radius) {
-require:
-     x      >= 0;
-     y      >= 0;
-     radius >  x;
-ensure:
-     Circle >= 0;
-}
-
-%inline %{
-extern int Circle (int x, int y, int radius);
-%}
diff --git a/Examples/contract/simple_c/runme1.py b/Examples/contract/simple_c/runme1.py
deleted file mode 100644
index abd8df6..0000000
--- a/Examples/contract/simple_c/runme1.py
+++ /dev/null
@@ -1,17 +0,0 @@
-import example 
-# Call the Circle() function correctly
-
-x = 1;
-y = 1;
-r = 3;
-
-c = example.Circle(x, y, r)
-
-# test post-assertion
-x = 1;
-y = 1;
-r = 2;
-
-c = example.Circle(x, y, r)
-
-print "The return value of Circle(%d, %d, %d) is %d" % (x,y,r,c)
diff --git a/Examples/contract/simple_c/runme2.py b/Examples/contract/simple_c/runme2.py
deleted file mode 100644
index 48d4a3f..0000000
--- a/Examples/contract/simple_c/runme2.py
+++ /dev/null
@@ -1,20 +0,0 @@
-import example 
-
-# Call the Circle() function correctly
-
-x = 1;
-y = 1;
-r = 3;
-
-c = example.Circle(x, y, r)
-
-print "The return value of Circle(%d, %d, %d) is %d" % (x,y,r,c)
-
-# test pre-assertion
-x = 1;
-y = -1;
-r = 3;
-
-c = example.Circle(x, y, r)
-
-print "The return value of Circle(%d, %d, %d) is %d" % (x,y,r,c)
diff --git a/Examples/contract/simple_cxx/example.cxx b/Examples/contract/simple_cxx/example.cxx
deleted file mode 100644
index e3dd2ca..0000000
--- a/Examples/contract/simple_cxx/example.cxx
+++ /dev/null
@@ -1,30 +0,0 @@
-#include "example.h"
-
-#define M_PI 3.14159265358979323846
-
-/* Move the shape to a new location */
-void Shape::move(double dx, double dy) {
-  x += dx;
-  y += dy;
-}
-
-int Shape::nshapes = 0;
-
-double Circle::area(void) {
-  /* return -1 is to test post-assertion */
-  if (radius == 1)
-    return -1;
-  return M_PI*radius*radius;
-}
-
-double Circle::perimeter(void) {
-  return 2*M_PI*radius;
-}
-
-double Square::area(void) {
-  return width*width;
-}
-
-double Square::perimeter(void) {
-  return 4*width;
-}
diff --git a/Examples/contract/simple_cxx/example.h b/Examples/contract/simple_cxx/example.h
deleted file mode 100644
index de708bb7..0000000
--- a/Examples/contract/simple_cxx/example.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* File : example.h */
-
-class Shape {
-public:
-  Shape() {
-    nshapes++;
-  }
-  virtual ~Shape() {
-    nshapes--;
-  }
-  double  x, y;   
-  void    move(double dx, double dy);
-  virtual double area(void) = 0;
-  virtual double perimeter(void) = 0;
-  static  int nshapes;
-};
-
-class Circle : public Shape {
-private:
-  double radius;
-public:
-  Circle(double r) : radius(r) { }
-  virtual double area(void);
-  virtual double perimeter(void);
-};
-
-class Square : public Shape {
-private:
-  double width;
-public:
-  Square(double w) : width(w) { }
-  virtual double area(void);
-  virtual double perimeter(void);
-};
diff --git a/Examples/contract/simple_cxx/example.i b/Examples/contract/simple_cxx/example.i
deleted file mode 100644
index 9b47409..0000000
--- a/Examples/contract/simple_cxx/example.i
+++ /dev/null
@@ -1,28 +0,0 @@
-%module example
-
-%contract Circle::Circle(double radius) {
-require:
-    radius > 0;
-}
-
-%contract Circle::area(void) {
-ensure:
-    area > 0;
-}
-
-%contract Shape::move(double dx, double dy) {
-require:
-    dx > 0;
-}
-
-/* should be no effect, since there is no move() for class Circle */
-%contract Circle::move(double dx, double dy) {
-require:
-    dy > 1;
-}
-
-# include must be after contracts
-%{
-#include "example.h"
-%}
-%include "example.h"
diff --git a/Examples/contract/simple_cxx/runme1.py b/Examples/contract/simple_cxx/runme1.py
deleted file mode 100644
index 9028d02..0000000
--- a/Examples/contract/simple_cxx/runme1.py
+++ /dev/null
@@ -1,33 +0,0 @@
-import example 
-
-# Create the Circle object
-
-r = 2;
-print "  Creating circle (radium: %d) :" % r
-c = example.Circle(r)
-
-# Set the location of the object
-
-c.x = 20
-c.y = 30
-print "  Here is its current position:"
-print "    Circle = (%f, %f)" % (c.x,c.y)
-
-# ----- Call some methods -----
-
-print "\n  Here are some properties of the Circle:"
-print "    area      = ", c.area()
-print "    perimeter = ", c.perimeter()
-dx = 1;
-dy = 1;
-print "    Moving with (%d, %d)..." % (dx, dy)
-c.move(dx, dy)
-
-del c
-
-print "==================================="
-
-# test construction */
-r = -1;
-print "  Creating circle (radium: %d) :" % r 
-c = example.Circle(r)
diff --git a/Examples/contract/simple_cxx/runme2.py b/Examples/contract/simple_cxx/runme2.py
deleted file mode 100644
index 5f9c0df..0000000
--- a/Examples/contract/simple_cxx/runme2.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import example 
-
-# Create the Circle object
-
-r = 2;
-print "  Creating circle (radium: %d) :" % r
-c = example.Circle(r)
-
-# Set the location of the object
-
-c.x = 20
-c.y = 30
-print "  Here is its current position:"
-print "    Circle = (%f, %f)" % (c.x,c.y)
-
-# ----- Call some methods -----
-
-print "\n  Here are some properties of the Circle:"
-print "    area      = ", c.area()
-print "    perimeter = ", c.perimeter()
-dx = 1;
-dy = 1;
-print "    Moving with (%d, %d)..." % (dx, dy)
-c.move(dx, dy)
-
-del c
-
-print "==================================="
-
-# test area function */
-r = 1;
-print "  Creating circle (radium: %d) :" % r 
-c = example.Circle(r)
-# Set the location of the object
-
-c.x = 20
-c.y = 30
-print "  Here is its current position:"
-print "    Circle = (%f, %f)" % (c.x,c.y)
-
-# ----- Call some methods -----
-
-print "\n  Here are some properties of the Circle:"
-print "    area      = ", c.area()
diff --git a/Examples/contract/simple_cxx/runme3.py b/Examples/contract/simple_cxx/runme3.py
deleted file mode 100644
index a663732..0000000
--- a/Examples/contract/simple_cxx/runme3.py
+++ /dev/null
@@ -1,57 +0,0 @@
-import example 
-
-# Create the Circle object
-
-r = 2;
-print "  Creating circle (radium: %d) :" % r
-c = example.Circle(r)
-
-# Set the location of the object
-
-c.x = 20
-c.y = 30
-print "  Here is its current position:"
-print "    Circle = (%f, %f)" % (c.x,c.y)
-
-# ----- Call some methods -----
-
-print "\n  Here are some properties of the Circle:"
-print "    area      = ", c.area()
-print "    perimeter = ", c.perimeter()
-dx = 1;
-dy = 1;
-print "    Moving with (%d, %d)..." % (dx, dy)
-c.move(dx, dy)
-
-del c
-
-print "==================================="
-
-# test move function */
-r = 2;
-print "  Creating circle (radium: %d) :" % r 
-c = example.Circle(r)
-# Set the location of the object
-
-c.x = 20
-c.y = 30
-print "  Here is its current position:"
-print "    Circle = (%f, %f)" % (c.x,c.y)
-
-# ----- Call some methods -----
-
-print "\n  Here are some properties of the Circle:"
-print "    area      = ", c.area()
-print "    perimeter = ", c.perimeter()
-
-# no error for Circle's pre-assertion
-dx = 1;
-dy = -1;
-print "    Moving with (%d, %d)..." % (dx, dy)
-c.move(dx, dy)
-
-# error with Shape's pre-assertion
-dx = -1;
-dy = 1;
-print "    Moving with (%d, %d)..." % (dx, dy)
-c.move(dx, dy)
diff --git a/Examples/guile/check.list b/Examples/guile/check.list
index 726e6ab..1f22adf 100644
--- a/Examples/guile/check.list
+++ b/Examples/guile/check.list
@@ -1,9 +1,9 @@
 # see top-level Makefile.in
-constants
 class
-port
-simple
-std_vector
+constants
 matrix
 multimap
 multivalue
+port
+simple
+std_vector
diff --git a/Examples/octave/check.list b/Examples/octave/check.list
index e9c7192..54a5910 100644
--- a/Examples/octave/check.list
+++ b/Examples/octave/check.list
@@ -8,8 +8,8 @@
 funcptr
 funcptr2
 functor
-operator
 module_load
+operator
 pointer
 reference
 simple
diff --git a/Examples/python/callback/runme.py b/Examples/python/callback/runme.py
index 345a3eb..41deb83 100644
--- a/Examples/python/callback/runme.py
+++ b/Examples/python/callback/runme.py
@@ -11,7 +11,7 @@
         example.Callback.__init__(self)
 
     def run(self):
-        print "PyCallback.run()"
+        print("PyCallback.run()")
 
 # Create an Caller instance
 
@@ -20,8 +20,8 @@
 # Add a simple C++ callback (caller owns the callback, so
 # we disown it first by clearing the .thisown flag).
 
-print "Adding and calling a normal C++ callback"
-print "----------------------------------------"
+print("Adding and calling a normal C++ callback")
+print("----------------------------------------")
 
 callback = example.Callback()
 callback.thisown = 0
@@ -29,9 +29,9 @@
 caller.call()
 caller.delCallback()
 
-print
-print "Adding and calling a Python callback"
-print "------------------------------------"
+print("")
+print("Adding and calling a Python callback")
+print("------------------------------------")
 
 # Add a Python callback (caller owns the callback, so we
 # disown it first by calling __disown__).
@@ -40,9 +40,9 @@
 caller.call()
 caller.delCallback()
 
-print
-print "Adding and calling another Python callback"
-print "------------------------------------------"
+print("")
+print("Adding and calling another Python callback")
+print("------------------------------------------")
 
 # Let's do the same but use the weak reference this time.
 
@@ -53,5 +53,5 @@
 
 # All done.
 
-print
-print "python exit"
+print("")
+print("python exit")
diff --git a/Examples/python/check.list b/Examples/python/check.list
index 0798b5f..025278f 100644
--- a/Examples/python/check.list
+++ b/Examples/python/check.list
@@ -13,8 +13,8 @@
 funcptr2
 functor
 import
-import_template
 import_packages
+import_template
 #libffi
 multimap
 operator
@@ -22,8 +22,8 @@
 reference
 simple
 smartptr
-std_vector
 std_map
+std_vector
 template
 varargs
 variables
diff --git a/Examples/python/class/runme.py b/Examples/python/class/runme.py
index 34d2150..adade74 100644
--- a/Examples/python/class/runme.py
+++ b/Examples/python/class/runme.py
@@ -7,15 +7,15 @@
 
 # ----- Object creation -----
 
-print "Creating some objects:"
+print("Creating some objects:")
 c = example.Circle(10)
-print "    Created circle", c
+print("    Created circle %s" % c)
 s = example.Square(10)
-print "    Created square", s
+print("    Created square %s" % s)
 
 # ----- Access a static member -----
 
-print "\nA total of", example.cvar.Shape_nshapes, "shapes were created"
+print("\nA total of %d shapes were created" % example.cvar.Shape_nshapes)
 
 # ----- Member data access -----
 
@@ -27,25 +27,25 @@
 s.x = -10
 s.y = 5
 
-print "\nHere is their current position:"
-print "    Circle = (%f, %f)" % (c.x, c.y)
-print "    Square = (%f, %f)" % (s.x, s.y)
+print("\nHere is their current position:")
+print("    Circle = (%f, %f)" % (c.x, c.y))
+print("    Square = (%f, %f)" % (s.x, s.y))
 
 # ----- Call some methods -----
 
-print "\nHere are some properties of the shapes:"
+print("\nHere are some properties of the shapes:")
 for o in [c, s]:
-    print "   ", o
-    print "        area      = ", o.area()
-    print "        perimeter = ", o.perimeter()
+    print("    %s" % o)
+    print("        area      = %s" % o.area())
+    print("        perimeter = %s" % o.perimeter())
 # prevent o from holding a reference to the last object looked at
 o = None
 
-print "\nGuess I'll clean up now"
+print("\nGuess I'll clean up now")
 
 # Note: this invokes the virtual destructor
 del c
 del s
 
-print example.cvar.Shape_nshapes, "shapes remain"
-print "Goodbye"
+print("%d shapes remain" % example.cvar.Shape_nshapes)
+print("Goodbye")
diff --git a/Examples/python/constants/runme.py b/Examples/python/constants/runme.py
index 415d1ad..808bf1f 100644
--- a/Examples/python/constants/runme.py
+++ b/Examples/python/constants/runme.py
@@ -2,22 +2,24 @@
 
 import example
 
-print "ICONST  =", example.ICONST, "(should be 42)"
-print "FCONST  =", example.FCONST, "(should be 2.1828)"
-print "CCONST  =", example.CCONST, "(should be 'x')"
-print "CCONST2 =", example.CCONST2, "(this should be on a new line)"
-print "SCONST  =", example.SCONST, "(should be 'Hello World')"
-print "SCONST2 =", example.SCONST2, "(should be '\"Hello World\"')"
-print "EXPR    =", example.EXPR, "(should be 48.5484)"
-print "iconst  =", example.iconst, "(should be 37)"
-print "fconst  =", example.fconst, "(should be 3.14)"
+print("ICONST  = %s (should be 42)" % example.ICONST)
+print("FCONST  = %s (should be 2.1828)" % example.FCONST)
+print("CCONST  = %s (should be 'x')" % example.CCONST)
+print("CCONST2 = %s (this should be on a new line)" % example.CCONST2)
+print("SCONST  = %s (should be 'Hello World')" % example.SCONST)
+print("SCONST2 = %s (should be '\"Hello World\"')" % example.SCONST2)
+print("EXPR    = %s (should be 48.5484)" % example.EXPR)
+print("iconst  = %s (should be 37)" % example.iconst)
+print("fconst  = %s (should be 3.14)" % example.fconst)
 
 try:
-    print "EXTERN = ", example.EXTERN, "(Arg! This shouldn't print anything)"
+    x = example.EXTERN
+    print("%s (Arg! This shouldn't print anything)" % x)
 except AttributeError:
-    print "EXTERN isn't defined (good)"
+    print("EXTERN isn't defined (good)")
 
 try:
-    print "FOO    = ", example.FOO, "(Arg! This shouldn't print anything)"
+    x = example.FOO
+    print("%s (Arg! This shouldn't print anything)" % x)
 except AttributeError:
-    print "FOO isn't defined (good)"
+    print("FOO isn't defined (good)")
diff --git a/Examples/python/contract/runme.py b/Examples/python/contract/runme.py
index ce01e5a..ec0aceb 100644
--- a/Examples/python/contract/runme.py
+++ b/Examples/python/contract/runme.py
@@ -7,15 +7,15 @@
 x = 42
 y = 105
 g = example.gcd(x, y)
-print "The gcd of %d and %d is %d" % (x, y, g)
+print("The gcd of %d and %d is %d" % (x, y, g))
 
 # Manipulate the Foo global variable
 
 # Output its current value
-print "Foo = ", example.cvar.Foo
+print("Foo = %s" % example.cvar.Foo)
 
 # Change its value
 example.cvar.Foo = 3.1415926
 
 # See if the change took effect
-print "Foo = ", example.cvar.Foo
+print("Foo = %s" % example.cvar.Foo)
diff --git a/Examples/python/docstrings/runme.py b/Examples/python/docstrings/runme.py
index c25d291..76386d2 100644
--- a/Examples/python/docstrings/runme.py
+++ b/Examples/python/docstrings/runme.py
@@ -2,4 +2,4 @@
 
 import example
 
-print "example.Foo.bar.__doc__  =", repr(example.Foo.bar.__doc__), "(Should be 'No comment')"
+print("example.Foo.bar.__doc__ = %s (Should be 'No comment')" % repr(example.Foo.bar.__doc__))
diff --git a/Examples/python/doxygen/runme.py b/Examples/python/doxygen/runme.py
index e235288..657535c 100644
--- a/Examples/python/doxygen/runme.py
+++ b/Examples/python/doxygen/runme.py
@@ -5,24 +5,24 @@
 
 import example
 
-print "Creating some objects:"
+print("Creating some objects:")
 c = example.MakeCircle(10)
-print "    Created circle", c
+print("    Created circle %s" % c)
 s = example.MakeSquare(10)
-print "    Created square", s
+print("    Created square %s" % s)
 r = example.MakeRectangleInt(10, 20)
-print "    Created rectangle", r
+print("    Created rectangle %s" % r)
 
-print "\nHere are some properties of the shapes:"
+print("\nHere are some properties of the shapes:")
 for o in [c, s, r]:
-    print "   ", o
-    print "        area      = ", o.area()
-    print "        perimeter = ", o.perimeter()
+    print("    %s" % o)
+    print("        area      = %s" % o.area())
+    print("        perimeter = %s" % o.perimeter())
 
-print "\nRunning pydoc, this is the equivalent to executing: pydoc -w ./example.py"
+print("\nRunning pydoc, this is the equivalent to executing: pydoc -w ./example.py")
 
 import pydoc
 
 pydoc.writedoc("example")
 
-print "Open example.html in your browser to view the generated python docs"
+print("Open example.html in your browser to view the generated python docs")
diff --git a/Examples/python/enum/runme.py b/Examples/python/enum/runme.py
index def01b1..4920c1d 100644
--- a/Examples/python/enum/runme.py
+++ b/Examples/python/enum/runme.py
@@ -5,24 +5,24 @@
 # ----- Object creation -----
 
 # Print out the value of some enums
-print "*** color ***"
-print "    RED    =", example.RED
-print "    BLUE   =", example.BLUE
-print "    GREEN  =", example.GREEN
+print("*** color ***")
+print("    RED    = %s" % example.RED)
+print("    BLUE   = %s" % example.BLUE)
+print("    GREEN  = %s" % example.GREEN)
 
-print "\n*** Foo::speed ***"
-print "    Foo_IMPULSE   =", example.Foo.IMPULSE
-print "    Foo_WARP      =", example.Foo.WARP
-print "    Foo_LUDICROUS =", example.Foo.LUDICROUS
+print("\n*** Foo::speed ***")
+print("    Foo_IMPULSE   = %s" % example.Foo.IMPULSE)
+print("    Foo_WARP      = %s" % example.Foo.WARP)
+print("    Foo_LUDICROUS = %s" % example.Foo.LUDICROUS)
 
-print "\nTesting use of enums with functions\n"
+print("\nTesting use of enums with functions\n")
 
 example.enum_test(example.RED, example.Foo.IMPULSE)
 example.enum_test(example.BLUE, example.Foo.WARP)
 example.enum_test(example.GREEN, example.Foo.LUDICROUS)
 example.enum_test(1234, 5678)
 
-print "\nTesting use of enum with class method"
+print("\nTesting use of enum with class method")
 f = example.Foo()
 
 f.enum_test(example.Foo.IMPULSE)
diff --git a/Examples/python/exception/runme.py b/Examples/python/exception/runme.py
index 7fae490..7b5c10d 100644
--- a/Examples/python/exception/runme.py
+++ b/Examples/python/exception/runme.py
@@ -7,36 +7,36 @@
 t = example.Test()
 try:
     t.unknown()
-except RuntimeError, e:
-    print "incomplete type", e.args[0]
+except RuntimeError as e:
+    print("incomplete type %s" % e.args[0])
 
 try:
     t.simple()
-except RuntimeError, e:
-    print e.args[0]
+except RuntimeError as e:
+    print(e.args[0])
 
 try:
     t.message()
-except RuntimeError, e:
-    print e.args[0]
+except RuntimeError as e:
+    print(e.args[0])
 
 if not example.is_python_builtin():
     try:
         t.hosed()
-    except example.Exc, e:
-        print e.code, e.msg
+    except example.Exc as e:
+        print("%s %s" % (e.code, e.msg))
 else:
     try:
         t.hosed()
-    except BaseException, e:
+    except BaseException as e:
         # Throwing builtin classes as exceptions not supported (-builtin
         # option)
-        print e
+        print(e)
 
 for i in range(1, 4):
     try:
         t.multi(i)
-    except RuntimeError, e:
-        print e.args[0]
-    except example.Exc, e:
-        print e.code, e.msg
+    except RuntimeError as e:
+        print(e.args[0])
+    except example.Exc as e:
+        print("%s %s" % (e.code, e.msg))
diff --git a/Examples/python/exceptproxy/runme.py b/Examples/python/exceptproxy/runme.py
index 970d620..d25fb6d 100644
--- a/Examples/python/exceptproxy/runme.py
+++ b/Examples/python/exceptproxy/runme.py
@@ -2,44 +2,44 @@
 import example
 
 if example.is_python_builtin():
-    print "Skipping example: -builtin option does not support %exceptionclass"
+    print("Skipping example: -builtin option does not support %exceptionclass")
     exit(0)
 
 q = example.intQueue(10)
 
-print "Inserting items into intQueue"
+print("Inserting items into intQueue")
 
-print type(example.FullError)
+print(type(example.FullError))
 
 try:
     for i in range(0, 100):
         q.enqueue(i)
-except example.FullError, e:
-    print "Maxsize is", e.maxsize
+except example.FullError as e:
+    print("Maxsize is %s" % e.maxsize)
 
-print "Removing items"
+print("Removing items")
 
 try:
-    while 1:
+    while True:
         q.dequeue()
-except example.EmptyError, e:
+except example.EmptyError as e:
     pass
 
 
 q = example.doubleQueue(1000)
 
-print "Inserting items into doubleQueue"
+print("Inserting items into doubleQueue")
 
 try:
     for i in range(0, 10000):
         q.enqueue(i * 1.5)
-except example.FullError, e:
-    print "Maxsize is", e.maxsize
+except example.FullError as e:
+    print("Maxsize is %s" % e.maxsize)
 
-print "Removing items"
+print("Removing items")
 
 try:
-    while 1:
+    while True:
         q.dequeue()
-except example.EmptyError, e:
+except example.EmptyError as e:
     pass
diff --git a/Examples/python/extend/runme.py b/Examples/python/extend/runme.py
index e97358b..d7e626e 100644
--- a/Examples/python/extend/runme.py
+++ b/Examples/python/extend/runme.py
@@ -21,9 +21,9 @@
 # the director wrappers to call CEO.getPosition.
 
 e = CEO("Alice")
-print e.getName(), "is a", e.getPosition()
-print "Just call her \"%s\"" % e.getTitle()
-print "----------------------"
+print("%s is a %s" % (e.getName(), e.getPosition()))
+print("Just call her \"%s\"" % e.getTitle())
+print("----------------------")
 
 
 # Create a new EmployeeList instance.  This class does not have a C++
@@ -40,7 +40,7 @@
 
 e = e.__disown__()
 list.addEmployee(e)
-print "----------------------"
+print("----------------------")
 
 # Now we access the first four items in list (three are C++ objects that
 # EmployeeList's constructor adds, the last is our CEO). The virtual
@@ -59,13 +59,13 @@
 # passes down through the C++ director class to the Python implementation
 # in CEO. All this routing takes place transparently.
 
-print "(position, title) for items 0-3:"
+print("(position, title) for items 0-3:")
 
-print "  %s, \"%s\"" % (list.get_item(0).getPosition(), list.get_item(0).getTitle())
-print "  %s, \"%s\"" % (list.get_item(1).getPosition(), list.get_item(1).getTitle())
-print "  %s, \"%s\"" % (list.get_item(2).getPosition(), list.get_item(2).getTitle())
-print "  %s, \"%s\"" % (list.get_item(3).getPosition(), list.get_item(3).getTitle())
-print "----------------------"
+print("  %s, \"%s\"" % (list.get_item(0).getPosition(), list.get_item(0).getTitle()))
+print("  %s, \"%s\"" % (list.get_item(1).getPosition(), list.get_item(1).getTitle()))
+print("  %s, \"%s\"" % (list.get_item(2).getPosition(), list.get_item(2).getTitle()))
+print("  %s, \"%s\"" % (list.get_item(3).getPosition(), list.get_item(3).getTitle()))
+print("----------------------")
 
 # Time to delete the EmployeeList, which will delete all the Employee*
 # items it contains. The last item is our CEO, which gets destroyed as its
@@ -75,8 +75,8 @@
 # usual to destroy the object.
 
 del list
-print "----------------------"
+print("----------------------")
 
 # All done.
 
-print "python exit"
+print("python exit")
diff --git a/Examples/python/funcptr/runme.py b/Examples/python/funcptr/runme.py
index bf0c6e1..4248f92 100644
--- a/Examples/python/funcptr/runme.py
+++ b/Examples/python/funcptr/runme.py
@@ -7,14 +7,14 @@
 
 # Now call our C function with a bunch of callbacks
 
-print "Trying some C callback functions"
-print "    a        =", a
-print "    b        =", b
-print "    ADD(a,b) =", example.do_op(a, b, example.ADD)
-print "    SUB(a,b) =", example.do_op(a, b, example.SUB)
-print "    MUL(a,b) =", example.do_op(a, b, example.MUL)
+print("Trying some C callback functions")
+print("    a        = %s" % a)
+print("    b        = %s" % b)
+print("    ADD(a,b) = %s" % example.do_op(a, b, example.ADD))
+print("    SUB(a,b) = %s" % example.do_op(a, b, example.SUB))
+print("    MUL(a,b) = %s" % example.do_op(a, b, example.MUL))
 
-print "Here is what the C callback function objects look like in Python"
-print "    ADD      =", example.ADD
-print "    SUB      =", example.SUB
-print "    MUL      =", example.MUL
+print("Here is what the C callback function objects look like in Python")
+print("    ADD      = %s" % example.ADD)
+print("    SUB      = %s" % example.SUB)
+print("    MUL      = %s" % example.MUL)
diff --git a/Examples/python/funcptr2/runme.py b/Examples/python/funcptr2/runme.py
index a4405d9..afa2e2d 100644
--- a/Examples/python/funcptr2/runme.py
+++ b/Examples/python/funcptr2/runme.py
@@ -7,18 +7,18 @@
 
 # Now call our C function with a bunch of callbacks
 
-print "Trying some C callback functions"
-print "    a        =", a
-print "    b        =", b
-print "    ADD(a,b) =", example.do_op(a, b, example.ADD)
-print "    SUB(a,b) =", example.do_op(a, b, example.SUB)
-print "    MUL(a,b) =", example.do_op(a, b, example.MUL)
+print("Trying some C callback functions")
+print("    a        = %s" % a)
+print("    b        = %s" % b)
+print("    ADD(a,b) = %s" % example.do_op(a, b, example.ADD))
+print("    SUB(a,b) = %s" % example.do_op(a, b, example.SUB))
+print("    MUL(a,b) = %s" % example.do_op(a, b, example.MUL))
 
-print "Here is what the C callback function objects look like in Python"
-print "    ADD      =", example.ADD
-print "    SUB      =", example.SUB
-print "    MUL      =", example.MUL
+print("Here is what the C callback function objects look like in Python")
+print("    ADD      = %s" % example.ADD)
+print("    SUB      = %s" % example.SUB)
+print("    MUL      = %s" % example.MUL)
 
-print "Call the functions directly..."
-print "    add(a,b) =", example.add(a, b)
-print "    sub(a,b) =", example.sub(a, b)
+print("Call the functions directly...")
+print("    add(a,b) = %s" % example.add(a, b))
+print("    sub(a,b) = %s" % example.sub(a, b))
diff --git a/Examples/python/functor/runme.py b/Examples/python/functor/runme.py
index 7f6f2b6..69289a7 100644
--- a/Examples/python/functor/runme.py
+++ b/Examples/python/functor/runme.py
@@ -12,5 +12,5 @@
     a(i)                # Note: function call
     b(math.sqrt(i))     # Note: function call
 
-print a.result()
-print b.result()
+print(a.result())
+print(b.result())
diff --git a/Examples/python/import/runme.py b/Examples/python/import/runme.py
index 0e83aca..afa21a2 100644
--- a/Examples/python/import/runme.py
+++ b/Examples/python/import/runme.py
@@ -1,15 +1,22 @@
 # file: runme.py
 # Test various properties of classes defined in separate modules
+import sys
 
-print "Testing the %import directive"
+print("Testing the %import directive")
+
 import base
 import foo
 import bar
 import spam
 
+def write_flush(s):
+    # Python 2/3 compatible write and flush
+    sys.stdout.write(s)
+    sys.stdout.flush()
+
 # Create some objects
 
-print "Creating some objects"
+print("Creating some objects")
 
 a = base.Base()
 b = foo.Foo()
@@ -17,91 +24,74 @@
 d = spam.Spam()
 
 # Try calling some methods
-print "Testing some methods"
-print "",
-print "Should see 'Base::A' ---> ",
+print("Testing some methods")
+
+write_flush("  Should see 'Base::A' ---> ")
 a.A()
-print "Should see 'Base::B' ---> ",
+write_flush("  Should see 'Base::B' ---> ")
 a.B()
 
-print "Should see 'Foo::A' ---> ",
+write_flush("  Should see 'Foo::A' ---> ")
 b.A()
-print "Should see 'Foo::B' ---> ",
+write_flush("  Should see 'Foo::B' ---> ")
 b.B()
 
-print "Should see 'Bar::A' ---> ",
+write_flush("  Should see 'Bar::A' ---> ")
 c.A()
-print "Should see 'Bar::B' ---> ",
+write_flush("  Should see 'Bar::B' ---> ")
 c.B()
 
-print "Should see 'Spam::A' ---> ",
+write_flush("  Should see 'Spam::A' ---> ")
 d.A()
-print "Should see 'Spam::B' ---> ",
+write_flush("  Should see 'Spam::B' ---> ")
 d.B()
 
 # Try some casts
 
-print "\nTesting some casts\n"
-print "",
+print("\nTesting some casts\n")
 
 x = a.toBase()
-print "Should see 'Base::A' ---> ",
+write_flush("  Should see 'Base::A' ---> ")
 x.A()
-print "Should see 'Base::B' ---> ",
+write_flush("  Should see 'Base::B' ---> ")
 x.B()
 
 x = b.toBase()
-print "Should see 'Foo::A' ---> ",
+write_flush("  Should see 'Foo::A' ---> ")
 x.A()
 
-print "Should see 'Base::B' ---> ",
+write_flush("  Should see 'Base::B' ---> ")
 x.B()
 
 x = c.toBase()
-print "Should see 'Bar::A' ---> ",
+write_flush("  Should see 'Bar::A' ---> ")
 x.A()
 
-print "Should see 'Base::B' ---> ",
+write_flush("  Should see 'Base::B' ---> ")
 x.B()
 
 x = d.toBase()
-print "Should see 'Spam::A' ---> ",
+write_flush("  Should see 'Spam::A' ---> ")
 x.A()
 
-print "Should see 'Base::B' ---> ",
+write_flush("  Should see 'Base::B' ---> ")
 x.B()
 
 x = d.toBar()
-print "Should see 'Bar::B' ---> ",
+write_flush("  Should see 'Bar::B' ---> ")
 x.B()
 
-print "\nTesting some dynamic casts\n"
+print("\nTesting some dynamic casts\n")
 x = d.toBase()
 
-print " Spam -> Base -> Foo : ",
 y = foo.Foo_fromBase(x)
-if y:
-    print "bad swig"
-else:
-    print "good swig"
+print("  Spam -> Base -> Foo : {} swig".format("bad" if y else "good"))
 
-print " Spam -> Base -> Bar : ",
 y = bar.Bar_fromBase(x)
-if y:
-    print "good swig"
-else:
-    print "bad swig"
+print("  Spam -> Base -> Bar : {} swig".format("good" if y else "bad"))
 
-print " Spam -> Base -> Spam : ",
 y = spam.Spam_fromBase(x)
-if y:
-    print "good swig"
-else:
-    print "bad swig"
+print("  Spam -> Base -> Spam : {} swig".format("good" if y else "bad"))
 
-print " Foo -> Spam : ",
 y = spam.Spam_fromBase(b)
-if y:
-    print "bad swig"
-else:
-    print "good swig"
+print("  Foo -> Spam : {} swig".format("bad" if y else "good"))
diff --git a/Examples/python/import_packages/from_init1/runme.py b/Examples/python/import_packages/from_init1/runme.py
index a663a13..c76716f 100644
--- a/Examples/python/import_packages/from_init1/runme.py
+++ b/Examples/python/import_packages/from_init1/runme.py
@@ -6,26 +6,26 @@
     if os.name != "nt" and sys.platform != "cygwin":
         # Strange failures on windows/cygin/mingw
         subprocess.check_call(commandline, env=env, shell=True)
-        print("  Finished running: " + commandline)
+        print(("  Finished running: " + commandline))
 
 # Test import of modules content from within __init__.py
 testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py")
 
 if sys.version_info < (2, 5):
-    print "  Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+    print("  Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'")
     sys.exit(0)
 
 if sys.version_info < (3, 0):
     import py2.pkg2
-    print "  Finished importing py2.pkg2"
+    print("  Finished importing py2.pkg2")
     commandline = sys.executable + " -m py2.pkg2.bar"
     run_except_on_windows(commandline)
     commandline = sys.executable + " -m py2.pkg2.foo"
     run_except_on_windows(commandline)
 else:
     import py3.pkg2
-    print "  Finished importing py3.pkg2"
+    print("  Finished importing py3.pkg2")
     # commandline = sys.executable + " -m py3.pkg2.bar"
     # run_except_on_windows(commandline)
     # commandline = sys.executable + " -m py3.pkg2.foo"
diff --git a/Examples/python/import_packages/from_init2/runme.py b/Examples/python/import_packages/from_init2/runme.py
index 3c7b126..c9c46a4 100644
--- a/Examples/python/import_packages/from_init2/runme.py
+++ b/Examples/python/import_packages/from_init2/runme.py
@@ -6,24 +6,24 @@
     if os.name != "nt" and sys.platform != "cygwin":
         # Strange failures on windows/cygin/mingw
         subprocess.check_call(commandline, env=env, shell=True)
-        print("  Finished running: " + commandline)
+        print(("  Finished running: " + commandline))
 
 # Test import of modules content from within __init__.py
 testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py")
 
 if sys.version_info < (2, 5):
-    print "  Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+    print("  Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'")
     sys.exit(0)
 
 if sys.version_info < (3, 0):
     import py2.pkg2
-    print "  Finished importing py2.pkg2"
+    print("  Finished importing py2.pkg2")
     commandline = sys.executable + " -m py2.pkg2.bar"
     run_except_on_windows(commandline)
 else:
     import py3.pkg2
-    print "  Finished importing py3.pkg2"
+    print("  Finished importing py3.pkg2")
     # commandline = sys.executable + " -m py3.pkg2.bar"
     # run_except_on_windows(commandline)
 
diff --git a/Examples/python/import_packages/from_init3/runme.py b/Examples/python/import_packages/from_init3/runme.py
index 3c7b126..c9c46a4 100644
--- a/Examples/python/import_packages/from_init3/runme.py
+++ b/Examples/python/import_packages/from_init3/runme.py
@@ -6,24 +6,24 @@
     if os.name != "nt" and sys.platform != "cygwin":
         # Strange failures on windows/cygin/mingw
         subprocess.check_call(commandline, env=env, shell=True)
-        print("  Finished running: " + commandline)
+        print(("  Finished running: " + commandline))
 
 # Test import of modules content from within __init__.py
 testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py")
 
 if sys.version_info < (2, 5):
-    print "  Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+    print("  Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'")
     sys.exit(0)
 
 if sys.version_info < (3, 0):
     import py2.pkg2
-    print "  Finished importing py2.pkg2"
+    print("  Finished importing py2.pkg2")
     commandline = sys.executable + " -m py2.pkg2.bar"
     run_except_on_windows(commandline)
 else:
     import py3.pkg2
-    print "  Finished importing py3.pkg2"
+    print("  Finished importing py3.pkg2")
     # commandline = sys.executable + " -m py3.pkg2.bar"
     # run_except_on_windows(commandline)
 
diff --git a/Examples/python/import_packages/module_is_init/runme.py b/Examples/python/import_packages/module_is_init/runme.py
index b5e646e..c4806cd 100644
--- a/Examples/python/import_packages/module_is_init/runme.py
+++ b/Examples/python/import_packages/module_is_init/runme.py
@@ -3,10 +3,10 @@
 
 # Test import of a SWIG generated module renamed as the package's __init__.py
 testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - module renamed as __init__.py"
+print("Testing " + testname + " - module renamed as __init__.py")
 
 if sys.version_info >= (3, 0, 0) and sys.version_info < (3, 3, 0):
-    print "  Not importing as Python version is >= 3.0 and < 3.3"
+    print("  Not importing as Python version is >= 3.0 and < 3.3")
     # Package detection does not work in these versions.
     # Can be fixed by using this in the interface file:
     #   %module(moduleimport="from . import $module") foo   # without -builtin
@@ -14,7 +14,7 @@
     sys.exit(0)
 
 import pkg1
-print "  Finished importing pkg1"
+print("  Finished importing pkg1")
 
 if pkg1.foofunction(123) != 1230:
     raise RuntimeError("foofunction failed")
@@ -23,4 +23,4 @@
 if fc.foomethod(1) != 6:
     raise RuntimeError("foomethod failed")
 
-print "  Finished testing pkg1"
+print("  Finished testing pkg1")
diff --git a/Examples/python/import_packages/namespace_pkg/runme.py b/Examples/python/import_packages/namespace_pkg/runme.py
index d2af056..54a8e4e 100644
--- a/Examples/python/import_packages/namespace_pkg/runme.py
+++ b/Examples/python/import_packages/namespace_pkg/runme.py
@@ -5,14 +5,14 @@
 import sys
 
 testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - namespace packages"
+print("Testing " + testname + " - namespace packages")
 
 if sys.version_info < (3, 3, 0):
-    print "  Not importing nstest as Python version is < 3.3"
+    print("  Not importing nstest as Python version is < 3.3")
     sys.exit(0)
 
 import nstest
 
-print "  Finished importing nstest"
+print("  Finished importing nstest")
 
 nstest.main()
diff --git a/Examples/python/import_packages/relativeimport1/runme.py b/Examples/python/import_packages/relativeimport1/runme.py
index 87101ea..3073cb5 100644
--- a/Examples/python/import_packages/relativeimport1/runme.py
+++ b/Examples/python/import_packages/relativeimport1/runme.py
@@ -6,26 +6,26 @@
     if os.name != "nt" and sys.platform != "cygwin":
         # Strange failures on windows/cygin/mingw
         subprocess.check_call(commandline, env=env, shell=True)
-        print("  Finished running: " + commandline)
+        print(("  Finished running: " + commandline))
 
 # Test import of modules content from within __init__.py
 testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) with -relativeimport"
+print("Testing " + testname + " - %module(package=...) with -relativeimport")
 
 if sys.version_info < (2, 5):
-    print "  Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+    print("  Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'")
     sys.exit(0)
 
 if sys.version_info < (3, 0):
     import py2.pkg2.bar
-    print "  Finished importing py2.pkg2.bar"
+    print("  Finished importing py2.pkg2.bar")
     commandline = sys.executable + " -m py2.pkg2.bar"
     run_except_on_windows(commandline)
     commandline = sys.executable + " -m py2.pkg2.pkg3.foo"
     run_except_on_windows(commandline)
 else:
     import py3.pkg2.bar
-    print "  Finished importing py3.pkg2.bar"
+    print("  Finished importing py3.pkg2.bar")
     commandline = sys.executable + " -m py3.pkg2.bar"
     run_except_on_windows(commandline)
     commandline = sys.executable + " -m py3.pkg2.pkg3.foo"
diff --git a/Examples/python/import_packages/relativeimport2/runme.py b/Examples/python/import_packages/relativeimport2/runme.py
index f5b5578..9ab8d94 100644
--- a/Examples/python/import_packages/relativeimport2/runme.py
+++ b/Examples/python/import_packages/relativeimport2/runme.py
@@ -6,26 +6,26 @@
     if os.name != "nt" and sys.platform != "cygwin":
         # Strange failures on windows/cygin/mingw
         subprocess.check_call(commandline, env=env, shell=True)
-        print("  Finished running: " + commandline)
+        print(("  Finished running: " + commandline))
 
 # Test import of modules content from within __init__.py
 testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py")
 
 if sys.version_info < (2, 5):
-    print "  Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+    print("  Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'")
     sys.exit(0)
 
 if sys.version_info < (3, 0):
     import py2.pkg2.bar
-    print "  Finished importing py2.pkg2.bar"
+    print("  Finished importing py2.pkg2.bar")
     commandline = sys.executable + " -m py2.pkg2.bar"
     run_except_on_windows(commandline)
     commandline = sys.executable + " -m py2.pkg2.pkg3.pkg4.foo"
     run_except_on_windows(commandline)
 else:
     import py3.pkg2.bar
-    print "  Finished importing py3.pkg2.bar"
+    print("  Finished importing py3.pkg2.bar")
     commandline = sys.executable + " -m py3.pkg2.bar"
     run_except_on_windows(commandline)
     commandline = sys.executable + " -m py3.pkg2.pkg3.pkg4.foo"
diff --git a/Examples/python/import_packages/relativeimport3/runme.py b/Examples/python/import_packages/relativeimport3/runme.py
index 87101ea..3073cb5 100644
--- a/Examples/python/import_packages/relativeimport3/runme.py
+++ b/Examples/python/import_packages/relativeimport3/runme.py
@@ -6,26 +6,26 @@
     if os.name != "nt" and sys.platform != "cygwin":
         # Strange failures on windows/cygin/mingw
         subprocess.check_call(commandline, env=env, shell=True)
-        print("  Finished running: " + commandline)
+        print(("  Finished running: " + commandline))
 
 # Test import of modules content from within __init__.py
 testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) with -relativeimport"
+print("Testing " + testname + " - %module(package=...) with -relativeimport")
 
 if sys.version_info < (2, 5):
-    print "  Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'"
+    print("  Skipping test as Python version is < 2.5 and does not support relative import syntax: 'from . import x'")
     sys.exit(0)
 
 if sys.version_info < (3, 0):
     import py2.pkg2.bar
-    print "  Finished importing py2.pkg2.bar"
+    print("  Finished importing py2.pkg2.bar")
     commandline = sys.executable + " -m py2.pkg2.bar"
     run_except_on_windows(commandline)
     commandline = sys.executable + " -m py2.pkg2.pkg3.foo"
     run_except_on_windows(commandline)
 else:
     import py3.pkg2.bar
-    print "  Finished importing py3.pkg2.bar"
+    print("  Finished importing py3.pkg2.bar")
     commandline = sys.executable + " -m py3.pkg2.bar"
     run_except_on_windows(commandline)
     commandline = sys.executable + " -m py3.pkg2.pkg3.foo"
diff --git a/Examples/python/import_packages/same_modnames1/runme.py b/Examples/python/import_packages/same_modnames1/runme.py
index a64551b..05846ed 100644
--- a/Examples/python/import_packages/same_modnames1/runme.py
+++ b/Examples/python/import_packages/same_modnames1/runme.py
@@ -6,21 +6,21 @@
     if os.name != "nt" and sys.platform != "cygwin":
         # Strange failures on windows/cygin/mingw
         subprocess.check_call(commandline, env=env, shell=True)
-        print("  Finished running: " + commandline)
+        print(("  Finished running: " + commandline))
 
 # Test import of same modules from different packages
 testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py")
 
 import pkg2.foo
-print "  Finished importing pkg2.foo"
+print("  Finished importing pkg2.foo")
 
 var2 = pkg2.foo.Pkg2_Foo()
 
 classname = str(type(var2))
 if classname.find("pkg2.foo.Pkg2_Foo") == -1:
     raise RuntimeError("failed type checking: " + classname)
-print "  Successfully created object pkg2.foo.Pkg2_Foo"
+print("  Successfully created object pkg2.foo.Pkg2_Foo")
 
 commandline = sys.executable + " -m pkg2.foo"
 run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/same_modnames2/runme.py b/Examples/python/import_packages/same_modnames2/runme.py
index c2cf274..190dadc 100644
--- a/Examples/python/import_packages/same_modnames2/runme.py
+++ b/Examples/python/import_packages/same_modnames2/runme.py
@@ -6,20 +6,20 @@
     if os.name != "nt" and sys.platform != "cygwin":
         # Strange failures on windows/cygin/mingw
         subprocess.check_call(commandline, env=env, shell=True)
-        print("  Finished running: " + commandline)
+        print(("  Finished running: " + commandline))
 
 testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py"
+print("Testing " + testname + " - %module(package=...) + python 'import' in __init__.py")
 
 import pkg1.pkg2.foo
-print "  Finished importing pkg1.pkg2.foo"
+print("  Finished importing pkg1.pkg2.foo")
 
 var2 = pkg1.pkg2.foo.Pkg2_Foo()
 
 classname = str(type(var2))
 if classname.find("pkg1.pkg2.foo.Pkg2_Foo") == -1:
     raise RuntimeError("failed type checking: " + classname)
-print "  Successfully created object pkg1.pkg2.foo.Pkg2_Foo"
+print("  Successfully created object pkg1.pkg2.foo.Pkg2_Foo")
 
 commandline = sys.executable + " -m pkg1.pkg2.foo"
 run_except_on_windows(commandline)
diff --git a/Examples/python/import_packages/split_modules/vanilla/runme.py b/Examples/python/import_packages/split_modules/vanilla/runme.py
index 79d79b4..0f7b880 100644
--- a/Examples/python/import_packages/split_modules/vanilla/runme.py
+++ b/Examples/python/import_packages/split_modules/vanilla/runme.py
@@ -6,14 +6,14 @@
     if os.name != "nt" and sys.platform != "cygwin":
         # Strange failures on windows/cygin/mingw
         subprocess.check_call(commandline, env=env, shell=True)
-        print("  Finished running: " + commandline)
+        print(("  Finished running: " + commandline))
 
 testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - split modules"
+print("Testing " + testname + " - split modules")
 
 import pkg1.foo
 
-print "  Finished importing pkg1.foo"
+print("  Finished importing pkg1.foo")
 
 if not(pkg1.foo.count() == 3):
     raise RuntimeError("test failed")
diff --git a/Examples/python/import_packages/split_modules/vanilla_split/runme.py b/Examples/python/import_packages/split_modules/vanilla_split/runme.py
index 79d79b4..0f7b880 100644
--- a/Examples/python/import_packages/split_modules/vanilla_split/runme.py
+++ b/Examples/python/import_packages/split_modules/vanilla_split/runme.py
@@ -6,14 +6,14 @@
     if os.name != "nt" and sys.platform != "cygwin":
         # Strange failures on windows/cygin/mingw
         subprocess.check_call(commandline, env=env, shell=True)
-        print("  Finished running: " + commandline)
+        print(("  Finished running: " + commandline))
 
 testname = os.path.basename(os.path.dirname(os.path.abspath(__file__)))
-print "Testing " + testname + " - split modules"
+print("Testing " + testname + " - split modules")
 
 import pkg1.foo
 
-print "  Finished importing pkg1.foo"
+print("  Finished importing pkg1.foo")
 
 if not(pkg1.foo.count() == 3):
     raise RuntimeError("test failed")
diff --git a/Examples/python/import_template/runme.py b/Examples/python/import_template/runme.py
index 35f8924..b14f8d3 100644
--- a/Examples/python/import_template/runme.py
+++ b/Examples/python/import_template/runme.py
@@ -1,15 +1,22 @@
 # file: runme.py
 # Test various properties of classes defined in separate modules
+import sys
 
-print "Testing the %import directive with templates"
+print("Testing the %import directive with templates")
+
 import base
 import foo
 import bar
 import spam
 
+def write_flush(s):
+    # Python 2/3 compatible write and flush
+    sys.stdout.write(s)
+    sys.stdout.flush()
+
 # Create some objects
 
-print "Creating some objects"
+print("Creating some objects")
 
 a = base.intBase()
 b = foo.intFoo()
@@ -17,91 +24,74 @@
 d = spam.intSpam()
 
 # Try calling some methods
-print "Testing some methods"
-print "",
-print "Should see 'Base::A' ---> ",
+print("Testing some methods")
+
+write_flush("  Should see 'Base::A' ---> ")
 a.A()
-print "Should see 'Base::B' ---> ",
+write_flush("  Should see 'Base::B' ---> ")
 a.B()
 
-print "Should see 'Foo::A' ---> ",
+write_flush("  Should see 'Foo::A' ---> ")
 b.A()
-print "Should see 'Foo::B' ---> ",
+write_flush("  Should see 'Foo::B' ---> ")
 b.B()
 
-print "Should see 'Bar::A' ---> ",
+write_flush("  Should see 'Bar::A' ---> ")
 c.A()
-print "Should see 'Bar::B' ---> ",
+write_flush("  Should see 'Bar::B' ---> ")
 c.B()
 
-print "Should see 'Spam::A' ---> ",
+write_flush("  Should see 'Spam::A' ---> ")
 d.A()
-print "Should see 'Spam::B' ---> ",
+write_flush("  Should see 'Spam::B' ---> ")
 d.B()
 
 # Try some casts
 
-print "\nTesting some casts\n"
-print "",
+print("\nTesting some casts\n")
 
 x = a.toBase()
-print "Should see 'Base::A' ---> ",
+write_flush("  Should see 'Base::A' ---> ")
 x.A()
-print "Should see 'Base::B' ---> ",
+write_flush("  Should see 'Base::B' ---> ")
 x.B()
 
 x = b.toBase()
-print "Should see 'Foo::A' ---> ",
+write_flush("  Should see 'Foo::A' ---> ")
 x.A()
 
-print "Should see 'Base::B' ---> ",
+write_flush("  Should see 'Base::B' ---> ")
 x.B()
 
 x = c.toBase()
-print "Should see 'Bar::A' ---> ",
+write_flush("  Should see 'Bar::A' ---> ")
 x.A()
 
-print "Should see 'Base::B' ---> ",
+write_flush("  Should see 'Base::B' ---> ")
 x.B()
 
 x = d.toBase()
-print "Should see 'Spam::A' ---> ",
+write_flush("  Should see 'Spam::A' ---> ")
 x.A()
 
-print "Should see 'Base::B' ---> ",
+write_flush("  Should see 'Base::B' ---> ")
 x.B()
 
 x = d.toBar()
-print "Should see 'Bar::B' ---> ",
+write_flush("  Should see 'Bar::B' ---> ")
 x.B()
 
-print "\nTesting some dynamic casts\n"
+print("\nTesting some dynamic casts\n")
 x = d.toBase()
 
-print " Spam -> Base -> Foo : ",
 y = foo.intFoo_fromBase(x)
-if y:
-    print "bad swig"
-else:
-    print "good swig"
+print("  Spam -> Base -> Foo : {} swig".format("bad" if y else "good"))
 
-print " Spam -> Base -> Bar : ",
 y = bar.intBar_fromBase(x)
-if y:
-    print "good swig"
-else:
-    print "bad swig"
+print("  Spam -> Base -> Bar : {} swig".format("good" if y else "bad"))
 
-print " Spam -> Base -> Spam : ",
 y = spam.intSpam_fromBase(x)
-if y:
-    print "good swig"
-else:
-    print "bad swig"
+print("  Spam -> Base -> Spam : {} swig".format("good" if y else "bad"))
 
-print " Foo -> Spam : ",
 y = spam.intSpam_fromBase(b)
-if y:
-    print "bad swig"
-else:
-    print "good swig"
+print("  Foo -> Spam : {} swig".format("bad" if y else "good"))
diff --git a/Examples/python/index.html b/Examples/python/index.html
index 3bbdd66..750c0f0 100644
--- a/Examples/python/index.html
+++ b/Examples/python/index.html
@@ -89,7 +89,6 @@
 <h2>Compatibility</h2>
 
 For Python 3, set the environment variable <tt>PY3=1</tt>.
-This will ensure the 2to3 program is run prior to running any example.
 
 <p>
 Your mileage may vary.  If you experience a problem, please let us know by 
diff --git a/Examples/python/multimap/runme.py b/Examples/python/multimap/runme.py
index ad693b7..e24f54e 100644
--- a/Examples/python/multimap/runme.py
+++ b/Examples/python/multimap/runme.py
@@ -7,14 +7,14 @@
 x = 42
 y = 105
 g = example.gcd(x, y)
-print "The gcd of %d and %d is %d" % (x, y, g)
+print("The gcd of %d and %d is %d" % (x, y, g))
 
 # Call the gcdmain() function
 example.gcdmain(["gcdmain", "42", "105"])
 
 # Call the count function
-print example.count("Hello World", "l")
+print(example.count("Hello World", "l"))
 
 # Call the capitalize function
 
-print example.capitalize("hello world")
+print(example.capitalize("hello world"))
diff --git a/Examples/python/operator/runme.py b/Examples/python/operator/runme.py
index ac48f26..ee479f0 100644
--- a/Examples/python/operator/runme.py
+++ b/Examples/python/operator/runme.py
@@ -4,17 +4,17 @@
 a = example.Complex(2, 3)
 b = example.Complex(-5, 10)
 
-print "a   =", a
-print "b   =", b
+print("a   = %s" % a)
+print("b   = %s" % b)
 
 c = a + b
-print "c   =", c
-print "a*b =", a * b
-print "a-c =", a - c
+print("c   = %s" % c)
+print("a*b = %s" % (a * b))
+print("a-c = %s" % (a - c))
 
 e = example.ComplexCopy(a - c)
-print "e   =", e
+print("e   = %s" % e)
 
 # Big expression
 f = ((a + b) * (c + b * e)) + (-a)
-print "f   =", f
+print("f   = %s" % f)
diff --git a/Examples/python/pointer/runme.py b/Examples/python/pointer/runme.py
index 5b5f16b..46371b8 100644
--- a/Examples/python/pointer/runme.py
+++ b/Examples/python/pointer/runme.py
@@ -3,23 +3,23 @@
 import example
 
 # First create some objects using the pointer library.
-print "Testing the pointer library"
+print("Testing the pointer library")
 a = example.new_intp()
 b = example.new_intp()
 c = example.new_intp()
 example.intp_assign(a, 37)
 example.intp_assign(b, 42)
 
-print "     a =", a
-print "     b =", b
-print "     c =", c
+print("     a = %s" % a)
+print("     b = %s" % b)
+print("     c = %s" % c)
 
 # Call the add() function with some pointers
 example.add(a, b, c)
 
 # Now get the result
 r = example.intp_value(c)
-print "     37 + 42 =", r
+print("     37 + 42 = %s" % r)
 
 # Clean up the pointers
 example.delete_intp(a)
@@ -30,12 +30,12 @@
 # This should be much easier. Now how it is no longer
 # necessary to manufacture pointers.
 
-print "Trying the typemap library"
+print("Trying the typemap library")
 r = example.sub(37, 42)
-print "     37 - 42 =", r
+print("     37 - 42 = %s" % r)
 
 # Now try the version with multiple return values
 
-print "Testing multiple return values"
+print("Testing multiple return values")
 q, r = example.divide(42, 37)
-print "     42/37 = %d remainder %d" % (q, r)
+print("     42/37 = %d remainder %d" % (q, r))
diff --git a/Examples/python/reference/runme.py b/Examples/python/reference/runme.py
index 0ff217b..8a96e03 100644
--- a/Examples/python/reference/runme.py
+++ b/Examples/python/reference/runme.py
@@ -6,12 +6,12 @@
 
 # ----- Object creation -----
 
-print "Creating some objects:"
+print("Creating some objects:")
 a = example.Vector(3, 4, 5)
 b = example.Vector(10, 11, 12)
 
-print "    Created", a.cprint()
-print "    Created", b.cprint()
+print("    Created %s" % a.cprint())
+print("    Created %s" % b.cprint())
 
 # ----- Call an overloaded operator -----
 
@@ -21,9 +21,9 @@
 #
 # It returns a new allocated object.
 
-print "Adding a+b"
+print("Adding a+b")
 c = example.addv(a, b)
-print "    a+b =", c.cprint()
+print("    a+b = %s" % c.cprint())
 
 # Note: Unless we free the result, a memory leak will occur
 del c
@@ -31,9 +31,9 @@
 # ----- Create a vector array -----
 
 # Note: Using the high-level interface here
-print "Creating an array of vectors"
+print("Creating an array of vectors")
 va = example.VectorArray(10)
-print "    va = ", va
+print("    va = %s" % va)
 
 # ----- Set some values in the array -----
 
@@ -45,17 +45,17 @@
 
 # Get some values from the array
 
-print "Getting some array values"
+print("Getting some array values")
 for i in range(0, 5):
-    print "    va(%d) = %s" % (i, va.get(i).cprint())
+    print("    va(%d) = %s" % (i, va.get(i).cprint()))
 
 # Watch under resource meter to check on this
-print "Making sure we don't leak memory."
-for i in xrange(0, 1000000):
+print("Making sure we don't leak memory.")
+for i in range(0, 1000000):
     c = va.get(i % 10)
 
 # ----- Clean up -----
-print "Cleaning up"
+print("Cleaning up")
 
 del va
 del a
diff --git a/Examples/python/simple/runme.py b/Examples/python/simple/runme.py
index ce01e5a..ec0aceb 100644
--- a/Examples/python/simple/runme.py
+++ b/Examples/python/simple/runme.py
@@ -7,15 +7,15 @@
 x = 42
 y = 105
 g = example.gcd(x, y)
-print "The gcd of %d and %d is %d" % (x, y, g)
+print("The gcd of %d and %d is %d" % (x, y, g))
 
 # Manipulate the Foo global variable
 
 # Output its current value
-print "Foo = ", example.cvar.Foo
+print("Foo = %s" % example.cvar.Foo)
 
 # Change its value
 example.cvar.Foo = 3.1415926
 
 # See if the change took effect
-print "Foo = ", example.cvar.Foo
+print("Foo = %s" % example.cvar.Foo)
diff --git a/Examples/python/smartptr/runme.py b/Examples/python/smartptr/runme.py
index 5f8b734..f01636a 100644
--- a/Examples/python/smartptr/runme.py
+++ b/Examples/python/smartptr/runme.py
@@ -7,17 +7,17 @@
 
 # ----- Object creation -----
 
-print "Creating some objects:"
+print("Creating some objects:")
 cc = example.Circle(10)
 c = example.ShapePtr(cc)
-print "    Created circle", c
+print("    Created circle %s" % c)
 ss = example.Square(10)
 s = example.ShapePtr(ss)
-print "    Created square", s
+print("    Created square %s" % s)
 
 # ----- Access a static member -----
 
-print "\nA total of", example.cvar.Shape_nshapes, "shapes were created"
+print("\nA total of %s shapes were created" % example.cvar.Shape_nshapes)
 
 # ----- Member data access -----
 
@@ -29,19 +29,19 @@
 s.x = -10
 s.y = 5
 
-print "\nHere is their current position:"
-print "    Circle = (%f, %f)" % (c.x, c.y)
-print "    Square = (%f, %f)" % (s.x, s.y)
+print("\nHere is their current position:")
+print("    Circle = (%f, %f)" % (c.x, c.y))
+print("    Square = (%f, %f)" % (s.x, s.y))
 
 # ----- Call some methods -----
 
-print "\nHere are some properties of the shapes:"
+print("\nHere are some properties of the shapes:")
 for o in [c, s]:
-    print "   ", o
-    print "        area      = ", o.area()
-    print "        perimeter = ", o.perimeter()
+    print("    %s" % o)
+    print("        area      = %s" % o.area())
+    print("        perimeter = %s" % o.perimeter())
 
-print "\nGuess I'll clean up now"
+print("\nGuess I'll clean up now")
 
 # Note: this invokes the virtual destructor
 del c
@@ -50,5 +50,5 @@
 del ss
 
 s = 3
-print example.cvar.Shape_nshapes, "shapes remain"
-print "Goodbye"
+print("%d shapes remain" % example.cvar.Shape_nshapes)
+print("Goodbye")
diff --git a/Examples/python/std_map/runme.py b/Examples/python/std_map/runme.py
index 26031f3..e86f613 100644
--- a/Examples/python/std_map/runme.py
+++ b/Examples/python/std_map/runme.py
@@ -11,45 +11,45 @@
 dmap["hello"] = 1.0
 dmap["hi"] = 2.0
 
-print dmap.items()
-print dmap.keys()
-print dmap.values()
+print(list(dmap.items()))
+print(list(dmap.keys()))
+print(list(dmap.values()))
 
-print dmap
+print(dmap)
 hmap = example.halfd(dmap)
 dmap = hmap
 
-print dmap
-for i in dmap.iterkeys():
-    print "key", i
+print(dmap)
+for i in dmap.keys():
+    print("key %s" % i)
 
-for i in dmap.itervalues():
-    print "val", i
+for i in dmap.values():
+    print("val %s" % i)
 
-for k, v in dmap.iteritems():
-    print "item", k, v
+for k, v in dmap.items():
+    print("item %s %s" % (k, v))
 
 dmap = example.DoubleMap()
 dmap["hello"] = 1.0
 dmap["hi"] = 2.0
 
-for i in dmap.iterkeys():
-    print "key", i
+for i in dmap.keys():
+    print("key %s" % i)
 
-for i in dmap.itervalues():
-    print "val", i
+for i in dmap.values():
+    print("val %s" % i)
 
-for k, v in dmap.iteritems():
-    print "item", k, v
+for k, v in dmap.items():
+    print("item %s %s" % (k, v))
 
 
-print dmap.items()
-print dmap.keys()
-print dmap.values()
+print(list(dmap.items()))
+print(list(dmap.keys()))
+print(list(dmap.values()))
 
 hmap = example.halfd(dmap)
-print hmap.keys()
-print hmap.values()
+print(list(hmap.keys()))
+print(list(hmap.values()))
 
 
 dmap = {}
@@ -57,23 +57,23 @@
 dmap["hi"] = 4
 
 hmap = example.halfi(dmap)
-print hmap
-print hmap.keys()
-print hmap.values()
+print(hmap)
+print(list(hmap.keys()))
+print(list(hmap.values()))
 
 
 dmap = hmap
 
-for i in dmap.iterkeys():
-    print "key", i
+for i in dmap.keys():
+    print("key %s" % i)
 
-for i in dmap.itervalues():
-    print "val", i
+for i in dmap.values():
+    print("val %s" % i)
 
-for i in dmap.iteritems():
-    print "item", i
+for i in dmap.items():
+    print("item %s" % str(i))
 
-for k, v in dmap.iteritems():
-    print "item", k, v
+for k, v in dmap.items():
+    print("item %s %s" % (k, v))
 
-print dmap
+print(dmap)
diff --git a/Examples/python/std_vector/runme.py b/Examples/python/std_vector/runme.py
index d7d3c2e..3f1106d 100644
--- a/Examples/python/std_vector/runme.py
+++ b/Examples/python/std_vector/runme.py
@@ -4,32 +4,30 @@
 
 # Call average with a Python list...
 
-print example.average([1, 2, 3, 4])
+print(example.average([1, 2, 3, 4]))
 
 # ... or a wrapped std::vector<int>
 
 v = example.IntVector(4)
 for i in range(len(v)):
     v[i] = i + 1
-print example.average(v)
+print(example.average(v))
 
 
 # half will return a Python list.
 # Call it with a Python tuple...
 
-print example.half((1.0, 1.5, 2.0, 2.5, 3.0))
+print(example.half((1.0, 1.5, 2.0, 2.5, 3.0)))
 
 # ... or a wrapped std::vector<double>
 
 v = example.DoubleVector()
 for i in [1, 2, 3, 4]:
     v.append(i)
-print example.half(v)
+print(example.half(v))
 
 
 # now halve a wrapped std::vector<double> in place
 
 example.halve_in_place(v)
-for i in range(len(v)):
-    print v[i], "; ",
-print
+print([i for i in v])
diff --git a/Examples/python/template/runme.py b/Examples/python/template/runme.py
index e408e15..85b1ba9 100644
--- a/Examples/python/template/runme.py
+++ b/Examples/python/template/runme.py
@@ -3,8 +3,8 @@
 import example
 
 # Call some templated functions
-print example.maxint(3, 7)
-print example.maxdouble(3.14, 2.18)
+print(example.maxint(3, 7))
+print(example.maxdouble(3.14, 2.18))
 
 # Create some class
 
@@ -21,12 +21,12 @@
 for i in range(0, 100):
     sum = sum + iv.getitem(i)
 
-print sum
+print(sum)
 
 sum = 0.0
 for i in range(0, 1000):
     sum = sum + dv.getitem(i)
-print sum
+print(sum)
 
 del iv
 del dv
diff --git a/Examples/python/variables/runme.py b/Examples/python/variables/runme.py
index 4d34e92..d59e0aa 100644
--- a/Examples/python/variables/runme.py
+++ b/Examples/python/variables/runme.py
@@ -22,51 +22,51 @@
 
 # Now print out the values of the variables
 
-print "Variables (values printed from Python)"
+print("Variables (values printed from Python)")
 
-print "ivar      =", example.cvar.ivar
-print "svar      =", example.cvar.svar
-print "lvar      =", example.cvar.lvar
-print "uivar     =", example.cvar.uivar
-print "usvar     =", example.cvar.usvar
-print "ulvar     =", example.cvar.ulvar
-print "scvar     =", example.cvar.scvar
-print "ucvar     =", example.cvar.ucvar
-print "fvar      =", example.cvar.fvar
-print "dvar      =", example.cvar.dvar
-print "cvar      =", example.cvar.cvar
-print "strvar    =", example.cvar.strvar
-print "cstrvar   =", example.cvar.cstrvar
-print "iptrvar   =", example.cvar.iptrvar
-print "name      =", example.cvar.name
-print "ptptr     =", example.cvar.ptptr, example.Point_print(example.cvar.ptptr)
-print "pt        =", example.cvar.pt, example.Point_print(example.cvar.pt)
+print("ivar      = %s" % example.cvar.ivar)
+print("svar      = %s" % example.cvar.svar)
+print("lvar      = %s" % example.cvar.lvar)
+print("uivar     = %s" % example.cvar.uivar)
+print("usvar     = %s" % example.cvar.usvar)
+print("ulvar     = %s" % example.cvar.ulvar)
+print("scvar     = %s" % example.cvar.scvar)
+print("ucvar     = %s" % example.cvar.ucvar)
+print("fvar      = %s" % example.cvar.fvar)
+print("dvar      = %s" % example.cvar.dvar)
+print("cvar      = %s" % example.cvar.cvar)
+print("strvar    = %s" % example.cvar.strvar)
+print("cstrvar   = %s" % example.cvar.cstrvar)
+print("iptrvar   = %s" % example.cvar.iptrvar)
+print("name      = %s" % example.cvar.name)
+print("ptptr     = %s %s" % (example.cvar.ptptr, example.Point_print(example.cvar.ptptr)))
+print("pt        = %s %s" % (example.cvar.pt, example.Point_print(example.cvar.pt)))
 
-print "\nVariables (values printed from C)"
+print("\nVariables (values printed from C)")
 
 example.print_vars()
 
-print "\nNow I'm going to try and modify some read only variables"
+print("\nNow I'm going to try and modify some read only variables")
 
-print "     Trying to set 'path'"
+print("     Trying to set 'path'")
 try:
     example.cvar.path = "Whoa!"
-    print "Hey, what's going on?!?! This shouldn't work"
+    print("Hey, what's going on?!?! This shouldn't work")
 except Exception:
-    print "Good."
+    print("Good.")
 
-print "     Trying to set 'status'"
+print("     Trying to set 'status'")
 try:
     example.cvar.status = 0
-    print "Hey, what's going on?!?! This shouldn't work"
+    print("Hey, what's going on?!?! This shouldn't work")
 except Exception:
-    print "Good."
+    print("Good.")
 
 
-print "\nI'm going to try and update a structure variable.\n"
+print("\nI'm going to try and update a structure variable.\n")
 
 example.cvar.pt = example.cvar.ptptr
 
-print "The new value is"
+print("The new value is")
 example.pt_print()
-print "You should see the value", example.Point_print(example.cvar.ptptr)
+print("You should see the value %s" % example.Point_print(example.cvar.ptptr))
diff --git a/Examples/scilab/check.list b/Examples/scilab/check.list
index 0bcf457..d57cfab 100644
--- a/Examples/scilab/check.list
+++ b/Examples/scilab/check.list
@@ -13,4 +13,3 @@
 struct
 template
 variables
-
diff --git a/Examples/test-suite/csharp/director_void_runme.cs b/Examples/test-suite/csharp/director_void_runme.cs
index 24b470f..ef440a7 100644
--- a/Examples/test-suite/csharp/director_void_runme.cs
+++ b/Examples/test-suite/csharp/director_void_runme.cs
@@ -67,6 +67,12 @@
       if (x != 1334)
         throw new Exception("Bad4 should be 1334, got " + x);
     }
+    {
+      MemberVoid mv = new MemberVoid();
+      global::System.IntPtr zero = global::System.IntPtr.Zero;
+      mv.memberVariable = zero;
+      zero = mv.memberVariable;
+    }
   }
 }
 
diff --git a/Examples/test-suite/csharp/li_std_wstring_runme.cs b/Examples/test-suite/csharp/li_std_wstring_runme.cs
index 8b7ba1b..d292728 100644
--- a/Examples/test-suite/csharp/li_std_wstring_runme.cs
+++ b/Examples/test-suite/csharp/li_std_wstring_runme.cs
@@ -75,6 +75,13 @@
         check_equal(li_std_wstring.test_ccvalue(x), "abc");
         check_equal(li_std_wstring.test_wchar_overload(x), "abc");
 
+        // Member variables
+        var s = new wchar_test_struct();
+        s.wchar_t_member = h;
+        check_equal(s.wchar_t_member, h);
+        s.wchar_t_ptr_member = x;
+        check_equal(s.wchar_t_ptr_member, "abc");
+
         {
             // Unicode strings
             string[] test_strings = {
@@ -99,6 +106,13 @@
                 check_equal(received, expected);
             }
 
+            foreach (string expected in test_strings)
+            {
+                s.wchar_t_ptr_member = expected;
+                string received = s.wchar_t_ptr_member;
+                check_equal(received, expected);
+            }
+
             /* Not working for Japanese and Russian characters on Windows, okay on Linux
              * Is fixed by adding CharSet=CharSet.Unicode to the DllImport, so change to:
              * [global::System.Runtime.InteropServices.DllImport("li_std_wstring", CharSet=global::System.Runtime.InteropServices.CharSet.Unicode, EntryPoint="CSharp_li_std_wstringNamespace_test_wcvalue")]
diff --git a/Examples/test-suite/director_basic.i b/Examples/test-suite/director_basic.i
index 07d6275..23d9103 100644
--- a/Examples/test-suite/director_basic.i
+++ b/Examples/test-suite/director_basic.i
@@ -5,6 +5,7 @@
 #endif
 
 %warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) MyClass::pmethod;
+%warnfilter(SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) ConstPtrClass::getConstPtr;
 
  %{
  #include <string>
@@ -174,7 +175,19 @@
   }
   
 };
-
-%}
+ %}
 
 %template(MyClassT_i) MyClassT<int>;
+
+ %feature("director") ConstPtrClass;
+
+ %inline %{
+
+class ConstPtrClass {
+public:
+  virtual ~ConstPtrClass() {}
+  virtual int *const getConstPtr() = 0;
+};
+
+ %}
+
diff --git a/Examples/test-suite/director_void.i b/Examples/test-suite/director_void.i
index 40f53b6..d9d99aa 100644
--- a/Examples/test-suite/director_void.i
+++ b/Examples/test-suite/director_void.i
@@ -43,5 +43,9 @@
     return *(int *)p;
   }
 };
+
+struct MemberVoid {
+  void *memberVariable;
+};
 %}
 
diff --git a/Examples/test-suite/javascript/Makefile.in b/Examples/test-suite/javascript/Makefile.in
index 8127415..4fab312 100644
--- a/Examples/test-suite/javascript/Makefile.in
+++ b/Examples/test-suite/javascript/Makefile.in
@@ -51,6 +51,7 @@
   # dunno... ignoring generously
   apply_signed_char.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
   constant_pointers.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
+  director_basic.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
   enum_thorough.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\"
 
 	setup_node = \
diff --git a/Examples/test-suite/li_std_wstring.i b/Examples/test-suite/li_std_wstring.i
index 55d4538..a790ca7 100644
--- a/Examples/test-suite/li_std_wstring.i
+++ b/Examples/test-suite/li_std_wstring.i
@@ -70,6 +70,11 @@
   return s.size();
 }
 
+struct wchar_test_struct {
+  wchar_t wchar_t_member;
+  wchar_t* wchar_t_ptr_member;
+};
+
 %}
 
 #endif
diff --git a/Examples/test-suite/multiple_inheritance_interfaces.i b/Examples/test-suite/multiple_inheritance_interfaces.i
index 2972922..98ec37b 100644
--- a/Examples/test-suite/multiple_inheritance_interfaces.i
+++ b/Examples/test-suite/multiple_inheritance_interfaces.i
@@ -64,3 +64,32 @@
   virtual void identical_overload(int i, const PTypedef &p = PTypedef()) {}
 };
 %}
+
+
+#if defined(SWIGJAVA) || defined(SWIGCSHARP)
+%interface(Space::X)
+#endif
+
+// Test the csinterfacemodifiers and javainterfacemodifiers typemaps.
+#if defined(SWIGCSHARP)
+/* change access from default "public class" to "internal class" */
+%typemap(csclassmodifiers) InternalAccess "internal class"
+/* The following modifiers are also needed with the above access modifier change */
+%typemap(csclassmodifiers) Space::X "internal class"
+%typemap(csinterfacemodifiers) Space::X "internal interface"
+#elif defined(SWIGJAVA)
+%typemap(javaclassmodifiers) InternalAccess "final /*notpublic*/ class"
+%typemap(javaclassmodifiers) Space::X "final class"
+%typemap(javainterfacemodifiers) Space::X "/*notpublic*/ interface"
+#endif
+
+%inline %{
+struct InternalAccess {};
+namespace Space {
+  class X {
+  public:
+    virtual void x(const InternalAccess& date) const = 0;
+    virtual ~X() {}
+  };
+}
+%}
diff --git a/Examples/test-suite/octave/abstract_access_runme.m b/Examples/test-suite/octave/abstract_access_runme.m
index e49343a..e47223c 100644
--- a/Examples/test-suite/octave/abstract_access_runme.m
+++ b/Examples/test-suite/octave/abstract_access_runme.m
@@ -2,6 +2,6 @@
 
 d = abstract_access.D();
 if (d.do_x() != 1)
-   error
+   error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/abstract_typedef_runme.m b/Examples/test-suite/octave/abstract_typedef_runme.m
index e57f715..6f90b81 100644
--- a/Examples/test-suite/octave/abstract_typedef_runme.m
+++ b/Examples/test-suite/octave/abstract_typedef_runme.m
@@ -10,7 +10,7 @@
   
 
 if (a.write(e) != 1)
-  error
+  error("failed");
 endif
 
 
diff --git a/Examples/test-suite/octave/callback_runme.m b/Examples/test-suite/octave/callback_runme.m
index db9f788..95df598 100644
--- a/Examples/test-suite/octave/callback_runme.m
+++ b/Examples/test-suite/octave/callback_runme.m
@@ -2,39 +2,39 @@
 callback
 
 if (foo(2) != 2)
-  error
+  error("failed");
 endif
 
 if (A_bar(2) != 4)
-  error
+  error("failed");
 endif
 
 if (foobar(3, _callback.foo) != foo(3))
-  error  
+  error("failed");
 endif
 
 if (foobar(3, foo) != foo(3))
-  error  
+  error("failed");
 endif
 
 if (foobar(3, A_bar) != A_bar(3))
-  error
+  error("failed");
 endif
 
 if (foobar(3, foof) != foof(3))
-  error
+  error("failed");
 endif
 
 if (foobar_i(3, foo_i) != foo_i(3))
-  error
+  error("failed");
 endif
 
 
 if (foobar_d(3.5, foo_d) != foo_d(3.5))
-  error
+  error("failed");
 endif
 
 a = A();
 if (foobarm(3, a, A.foom_cb_ptr) != a.foom(3))
-  error
+  error("failed");
 endif
diff --git a/Examples/test-suite/octave/class_ignore_runme.m b/Examples/test-suite/octave/class_ignore_runme.m
index 3e52047..53cad95 100644
--- a/Examples/test-suite/octave/class_ignore_runme.m
+++ b/Examples/test-suite/octave/class_ignore_runme.m
@@ -8,5 +8,5 @@
 a = class_ignore.Bar();
 
 if (!strcmp(class_ignore.do_blah(a),"Bar::blah"))
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/class_scope_weird_runme.m b/Examples/test-suite/octave/class_scope_weird_runme.m
index 2fc8578..b0e9753 100644
--- a/Examples/test-suite/octave/class_scope_weird_runme.m
+++ b/Examples/test-suite/octave/class_scope_weird_runme.m
@@ -3,5 +3,5 @@
 f = class_scope_weird.Foo();
 g = class_scope_weird.Foo(3);
 if (f.bar(3) != 3)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/compactdefaultargs_runme.m b/Examples/test-suite/octave/compactdefaultargs_runme.m
index 08e8727..ada60dc 100644
--- a/Examples/test-suite/octave/compactdefaultargs_runme.m
+++ b/Examples/test-suite/octave/compactdefaultargs_runme.m
@@ -4,21 +4,21 @@
 defaults1 = Defaults1();
 
 if (defaults1.ret(10.0) != 10.0)
-  error
+  error("failed");
 endif
 
 if (defaults1.ret() != -1.0)
-  error
+  error("failed");
 endif
 
 defaults2 = Defaults2(1000);
 defaults2 = Defaults2();
 
 if (defaults2.ret(10.0) != 10.0)
-  error
+  error("failed");
 endif
 
 if (defaults2.ret() != -1.0)
-  error
+  error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/constructor_copy_runme.m b/Examples/test-suite/octave/constructor_copy_runme.m
index e450214..b6d3c3b 100644
--- a/Examples/test-suite/octave/constructor_copy_runme.m
+++ b/Examples/test-suite/octave/constructor_copy_runme.m
@@ -10,7 +10,7 @@
 
 
 if (f1.x != f11.x)
-    error
+    error("failed");
 endif
 
 
@@ -23,7 +23,7 @@
 end_try_catch
 
 if (!good)
-    error
+    error("failed");
 endif
 
 
@@ -31,7 +31,7 @@
 bc = Bari(bi);
 
 if (bi.x != bc.x)
-    error
+    error("failed");
 endif
     
 
@@ -44,6 +44,6 @@
 end_try_catch
 
 if (!good)
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/default_args_runme.m b/Examples/test-suite/octave/default_args_runme.m
index 3d00f63..d2c6b4a 100644
--- a/Examples/test-suite/octave/default_args_runme.m
+++ b/Examples/test-suite/octave/default_args_runme.m
@@ -7,19 +7,19 @@
 
 
 if (default_args.Statics.staticmethod() != 60)
-  error
+  error("failed");
 endif
 
 if (default_args.cfunc1(1) != 2)
-  error
+  error("failed");
 endif
 
 if (default_args.cfunc2(1) != 3)
-  error
+  error("failed");
 endif
 
 if (default_args.cfunc3(1) != 4)
-  error
+  error("failed");
 endif
 
 
diff --git a/Examples/test-suite/octave/director_abstract_runme.m b/Examples/test-suite/octave/director_abstract_runme.m
index 657e2e1..c96cf75 100644
--- a/Examples/test-suite/octave/director_abstract_runme.m
+++ b/Examples/test-suite/octave/director_abstract_runme.m
@@ -28,17 +28,17 @@
 
 me1 = MyExample1();
 if (director_abstract.Example1.get_color(me1, 1,2,3) != 1)
-  error
+  error("failed");
 endif
 
 me2 = MyExample2(1,2);
 if (me2.get_color(me2, 1,2,3) != 2)
-  error
+  error("failed");
 endif
 
 me3 = MyExample3();
 if (me3.get_color(me3, 1,2,3) != 3)
-  error
+  error("failed");
 endif
 
 
diff --git a/Examples/test-suite/octave/director_basic_runme.m b/Examples/test-suite/octave/director_basic_runme.m
index 9de54a3..9a411a7 100644
--- a/Examples/test-suite/octave/director_basic_runme.m
+++ b/Examples/test-suite/octave/director_basic_runme.m
@@ -33,7 +33,7 @@
 a = director_basic.A1(1);
 
 if (a.rg(2) != 2)
-  error
+  error("failed");
 endif
 
 function self=OctClass()
@@ -62,16 +62,16 @@
 
 cc.method(b);
 if (c.cmethod != 7)
-  error
+  error("failed");
 endif
 
 if (bc.x != 34)
-  error
+  error("failed");
 endif
 
 
 if (bd.x != 16)
-  error
+  error("failed");
 endif
 
 
diff --git a/Examples/test-suite/octave/director_enum_runme.m b/Examples/test-suite/octave/director_enum_runme.m
index 96f158d..59a5ccf 100644
--- a/Examples/test-suite/octave/director_enum_runme.m
+++ b/Examples/test-suite/octave/director_enum_runme.m
@@ -6,5 +6,5 @@
 a = MyFoo();
 
 if (a.say_hi(director_enum.hello) != b.say_hello(director_enum.hi))
-  error
+  error("failed");
 endif
diff --git a/Examples/test-suite/octave/director_nested_runme.m b/Examples/test-suite/octave/director_nested_runme.m
index 6e1d0de..614af0c 100644
--- a/Examples/test-suite/octave/director_nested_runme.m
+++ b/Examples/test-suite/octave/director_nested_runme.m
@@ -31,9 +31,9 @@
 c.advance();
 
 if (!strcmp(c.get_name(),"FooBar::get_name hello"))
-  error
+  error("failed");
 endif
 
 if (!strcmp(c.name(),"FooBar::get_name hello"))
-  error
+  error("failed");
 endif
diff --git a/Examples/test-suite/octave/director_unroll_runme.m b/Examples/test-suite/octave/director_unroll_runme.m
index 6ca213c..607b9d5 100644
--- a/Examples/test-suite/octave/director_unroll_runme.m
+++ b/Examples/test-suite/octave/director_unroll_runme.m
@@ -11,6 +11,6 @@
 
 if (swig_this(a) != swig_this(c))
   a,c
-  error
+  error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/enum_template_runme.m b/Examples/test-suite/octave/enum_template_runme.m
index a9f940a..1474ce1 100644
--- a/Examples/test-suite/octave/enum_template_runme.m
+++ b/Examples/test-suite/octave/enum_template_runme.m
@@ -6,13 +6,13 @@
 enum_template
 
 if (enum_template.MakeETest() != 1)
-  error
+  error("failed");
 endif
 
 enum_template.TakeETest(0);
 try
   a=enum_template.TakeETest(0);
-  error
+  error("failed");
 catch
 end_try_catch
   
diff --git a/Examples/test-suite/octave/enums_runme.m b/Examples/test-suite/octave/enums_runme.m
index b654d9d..5f6bd69 100644
--- a/Examples/test-suite/octave/enums_runme.m
+++ b/Examples/test-suite/octave/enums_runme.m
@@ -6,18 +6,18 @@
 enums.bar1(1)
 
 if (enums.cvar.enumInstance != 2)
-  error
+  error("failed");
 endif
 
 if (enums.cvar.Slap != 10)
-  error
+  error("failed");
 endif
 
 if (enums.cvar.Mine != 11)
-  error
+  error("failed");
 endif
 
 if (enums.cvar.Thigh != 12)
-  error
+  error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/extend_template_ns_runme.m b/Examples/test-suite/octave/extend_template_ns_runme.m
index e79a00d..7196fac 100644
--- a/Examples/test-suite/octave/extend_template_ns_runme.m
+++ b/Examples/test-suite/octave/extend_template_ns_runme.m
@@ -7,9 +7,9 @@
 
 f = Foo_One();
 if (f.test1(37) != 37)
-    error
+    error("failed");
 endif
 
 if (f.test2(42) != 42)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/extend_template_runme.m b/Examples/test-suite/octave/extend_template_runme.m
index 1cad7bf..125bd4a 100644
--- a/Examples/test-suite/octave/extend_template_runme.m
+++ b/Examples/test-suite/octave/extend_template_runme.m
@@ -2,9 +2,9 @@
 
 f = extend_template.Foo_0();
 if (f.test1(37) != 37)
-    error
+    error("failed");
 endif
 
 if (f.test2(42) != 42)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/extend_variable_runme.m b/Examples/test-suite/octave/extend_variable_runme.m
index c55b6c5..89af26c 100644
--- a/Examples/test-suite/octave/extend_variable_runme.m
+++ b/Examples/test-suite/octave/extend_variable_runme.m
@@ -1,6 +1,6 @@
 extend_variable
 
 if (Foo.Bar != 42)
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/friends_runme.m b/Examples/test-suite/octave/friends_runme.m
index 3121156..50a5b20 100644
--- a/Examples/test-suite/octave/friends_runme.m
+++ b/Examples/test-suite/octave/friends_runme.m
@@ -8,25 +8,25 @@
 a = friends.A(2);
 
 if (friends.get_val1(a) != 2)
-  error
+  error("failed");
 endif
 if (friends.get_val2(a) != 4)
-  error
+  error("failed");
 endif
 if (friends.get_val3(a) != 6)
-  error
+  error("failed");
 endif
 
 				# nice overload working fine
 if (friends.get_val1(1,2,3) != 1)
-  error
+  error("failed");
 endif
 
 b = friends.B(3);
 
 				# David's case
 if (friends.mix(a,b) != 5)
-  error
+  error("failed");
 endif
 
 di = friends.D_d(2);
@@ -34,18 +34,18 @@
 
 				# incredible template overloading working just fine
 if (friends.get_val1(di) != 2)
-  error
+  error("failed");
 endif
 if (friends.get_val1(dd) != 3.3)
-  error
+  error("failed");
 endif
 
 friends.set(di, 4);
 friends.set(dd, 1.3);
 
 if (friends.get_val1(di) != 4)
-  error
+  error("failed");
 endif
 if (friends.get_val1(dd) != 1.3)
-  error
+  error("failed");
 endif
diff --git a/Examples/test-suite/octave/grouping_runme.m b/Examples/test-suite/octave/grouping_runme.m
index 6d1a2d6..4e2c9ea 100644
--- a/Examples/test-suite/octave/grouping_runme.m
+++ b/Examples/test-suite/octave/grouping_runme.m
@@ -7,14 +7,14 @@
 
 x = grouping.test1(42);
 if (x != 42)
-    error
+    error("failed");
 endif
 
 grouping.test2(42);
 
 x = (grouping.do_unary(37, grouping.NEGATE));
 if (x != -37)
-    error
+    error("failed");
 endif
 
 grouping.cvar.test3 = 42;
diff --git a/Examples/test-suite/octave/iadd_runme.m b/Examples/test-suite/octave/iadd_runme.m
index c386c66..70cd75d 100644
--- a/Examples/test-suite/octave/iadd_runme.m
+++ b/Examples/test-suite/octave/iadd_runme.m
@@ -6,5 +6,5 @@
 f.AsA += f.AsA;
 
 if (f.AsA.x != 6)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/inout_runme.m b/Examples/test-suite/octave/inout_runme.m
index 74caaff..c5d293e 100644
--- a/Examples/test-suite/octave/inout_runme.m
+++ b/Examples/test-suite/octave/inout_runme.m
@@ -2,26 +2,26 @@
 
 a = inout.AddOne1(1);
 if (a != 2)
-  error
+  error("failed");
 endif
 
 a = inout.AddOne3(1,1,1);
 if (a != [2,2,2])
-  error
+  error("failed");
 endif
 
 a = inout.AddOne1p((1,1));
 if (a != (2,2))
-  error
+  error("failed");
 endif
 
 a = inout.AddOne2p((1,1),1);
 if (a != [(2,2),2])
-  error
+  error("failed");
 endif
 
 a = inout.AddOne3p(1,(1,1),1);
 if (a != [2,(2,2),2])
-  error
+  error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/inplaceadd_runme.m b/Examples/test-suite/octave/inplaceadd_runme.m
index 2bc1937..50b680a 100644
--- a/Examples/test-suite/octave/inplaceadd_runme.m
+++ b/Examples/test-suite/octave/inplaceadd_runme.m
@@ -3,22 +3,22 @@
 
 a += 5;
 if (a.val != 12)
-  error
+  error("failed");
 endif
 
 a -= 5;
 if a.val != 7:
-  error
+  error("failed");
 endif
 
 a *= 2;
 
 if (a.val != 14)
-  error
+  error("failed");
 endif
 
 a += a;
 if (a.val != 28)
-  error
+  error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/input_runme.m b/Examples/test-suite/octave/input_runme.m
index 1a92d03..477ffaa 100644
--- a/Examples/test-suite/octave/input_runme.m
+++ b/Examples/test-suite/octave/input_runme.m
@@ -7,21 +7,21 @@
 
 f = Foo();
 if (f.foo(2) != 4)
-  error
+  error("failed");
 endif
 
 try
   a=f.foo();
-  error
+  error("failed");
 catch
 end_try_catch
 
 if (!strcmp(sfoo("Hello"),"Hello world"))
-  error
+  error("failed");
 endif
 
 try
   a=sfoo();
-  error
+  error("failed");
 catch
 end_try_catch
diff --git a/Examples/test-suite/octave/li_attribute_runme.m b/Examples/test-suite/octave/li_attribute_runme.m
index ed051d9..5e23904 100644
--- a/Examples/test-suite/octave/li_attribute_runme.m
+++ b/Examples/test-suite/octave/li_attribute_runme.m
@@ -8,7 +8,7 @@
 aa = li_attribute.A(1,2,3);
 
 if (aa.a != 1)
-  error
+  error("failed");
 endif
 aa.a = 3;
 if (aa.a != 3)
@@ -20,31 +20,31 @@
 endif
 aa.b = 5;
 if (aa.b != 5)
-  error
+  error("failed");
 endif
 
 if (aa.d != aa.b)
-  error
+  error("failed");
 endif
 
 if (aa.c != 3)
-  error
+  error("failed");
 endif
 
 pi = li_attribute.Param_i(7);
 if (pi.value != 7)
- error
+ error("failed");
 endif
 
 pi.value=3;
 if (pi.value != 3)
- error
+ error("failed");
 endif
 
 b = li_attribute.B(aa);
 
 if (b.a.c != 3)
- error
+ error("failed");
 endif
 
 # class/struct attribute with get/set methods using return/pass by reference
@@ -53,38 +53,38 @@
 myClass = li_attribute.MyClass();
 myClass.Foo = myFoo;
 if (myClass.Foo.x != 8)
-  error
+  error("failed");
 endif
 
 # class/struct attribute with get/set methods using return/pass by value
 myClassVal = li_attribute.MyClassVal();
 if (myClassVal.ReadWriteFoo.x != -1)
-  error
+  error("failed");
 endif
 if (myClassVal.ReadOnlyFoo.x != -1)
-  error
+  error("failed");
 endif
 myClassVal.ReadWriteFoo = myFoo;
 if (myClassVal.ReadWriteFoo.x != 8)
-  error
+  error("failed");
 endif
 if (myClassVal.ReadOnlyFoo.x != 8)
-  error
+  error("failed");
 endif
 
 # string attribute with get/set methods using return/pass by value
 myStringyClass = li_attribute.MyStringyClass("initial string");
 if (myStringyClass.ReadWriteString != "initial string")
-  error
+  error("failed");
 endif
 if (myStringyClass.ReadOnlyString != "initial string")
-  error
+  error("failed");
 endif
 myStringyClass.ReadWriteString = "changed string";
 if (myStringyClass.ReadWriteString != "changed string")
-  error
+  error("failed");
 endif
 if (myStringyClass.ReadOnlyString != "changed string")
-  error
+  error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/li_carrays_cpp_runme.m b/Examples/test-suite/octave/li_carrays_cpp_runme.m
index b3b5209..57e3e9a 100644
--- a/Examples/test-suite/octave/li_carrays_cpp_runme.m
+++ b/Examples/test-suite/octave/li_carrays_cpp_runme.m
@@ -11,5 +11,5 @@
 d(5) = d(0) + 3;
 
 if (d(5) + d(0) != 17)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/li_carrays_runme.m b/Examples/test-suite/octave/li_carrays_runme.m
index c6b5f16..5f180cc 100644
--- a/Examples/test-suite/octave/li_carrays_runme.m
+++ b/Examples/test-suite/octave/li_carrays_runme.m
@@ -11,5 +11,5 @@
 d(5) = d(0) + 3;
 
 if (d(5) + d(0) != 17)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/li_cmalloc_runme.m b/Examples/test-suite/octave/li_cmalloc_runme.m
index 92bcd95..5daea2c 100644
--- a/Examples/test-suite/octave/li_cmalloc_runme.m
+++ b/Examples/test-suite/octave/li_cmalloc_runme.m
@@ -17,6 +17,6 @@
 end_try_catch
 
 if (ok != 1)
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/li_cpointer_cpp_runme.m b/Examples/test-suite/octave/li_cpointer_cpp_runme.m
index 463cf44..3551a17 100644
--- a/Examples/test-suite/octave/li_cpointer_cpp_runme.m
+++ b/Examples/test-suite/octave/li_cpointer_cpp_runme.m
@@ -5,7 +5,7 @@
 intp_assign(p,3);
 
 if (intp_value(p) != 3)
-    error
+    error("failed");
 endif
 
 delete_intp(p);
diff --git a/Examples/test-suite/octave/li_cpointer_runme.m b/Examples/test-suite/octave/li_cpointer_runme.m
index ce055cd..995cc2a 100644
--- a/Examples/test-suite/octave/li_cpointer_runme.m
+++ b/Examples/test-suite/octave/li_cpointer_runme.m
@@ -10,7 +10,7 @@
 intp_assign(p,3);
 
 if (intp_value(p) != 3)
-    error
+    error("failed");
 endif
 
 delete_intp(p);
diff --git a/Examples/test-suite/octave/li_cstring_runme.m b/Examples/test-suite/octave/li_cstring_runme.m
index 8aea6b7..4a706d3 100644
--- a/Examples/test-suite/octave/li_cstring_runme.m
+++ b/Examples/test-suite/octave/li_cstring_runme.m
@@ -7,15 +7,15 @@
 
 
 if (count("ab\0ab\0ab\0", 0) != 3)
-    error    
+    error("failed");
 endif
 
 if (!strcmp(test1(),"Hello World"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(test2()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(test3("hello"),"hello-suffix"))
@@ -27,18 +27,18 @@
 endif
     
 if (!strcmp(test5(4),'xxxx'))
-    error
+    error("failed");
 endif
 
 if (!strcmp(test6(10),'xxxxx'))
-    error
+    error("failed");
 endif
     
 if (!strcmp(test7(),"Hello world!"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(test8()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/li_cwstring_runme.m b/Examples/test-suite/octave/li_cwstring_runme.m
index 1fb0962..5b90551 100644
--- a/Examples/test-suite/octave/li_cwstring_runme.m
+++ b/Examples/test-suite/octave/li_cwstring_runme.m
@@ -6,38 +6,38 @@
 li_cwstring
 
 if (count("ab\0ab\0ab\0", 0) != 3)
-    error    
+    error("failed");
 endif
 
 if (!strcmp(test1(),"Hello World"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(test2()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(test3("hello"),"hello-suffix"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(test4("hello"),"hello-suffix"))
-    error
+    error("failed");
 endif
     
 if (!strcmp(test5(4),'xxxx'))
-    error
+    error("failed");
 endif
 
 if (!strcmp(test6(10),'xxxxx'))
-    error
+    error("failed");
 endif
     
 if (!strcmp(test7(),"Hello world!"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(test8()," !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_"))
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/li_factory_runme.m b/Examples/test-suite/octave/li_factory_runme.m
index 5ea9b77..7c07825 100644
--- a/Examples/test-suite/octave/li_factory_runme.m
+++ b/Examples/test-suite/octave/li_factory_runme.m
@@ -8,11 +8,11 @@
 circle = Geometry_create(Geometry.CIRCLE);
 r = circle.radius();
 if (r != 1.5)
-  error
+  error("failed");
 endif
 
 point = Geometry_create(Geometry.POINT);
 w = point.width();
 if (w != 1.0)
-  error
+  error("failed");
 endif
diff --git a/Examples/test-suite/octave/li_std_carray_runme.m b/Examples/test-suite/octave/li_std_carray_runme.m
index 4943fa8..f7212dc 100644
--- a/Examples/test-suite/octave/li_std_carray_runme.m
+++ b/Examples/test-suite/octave/li_std_carray_runme.m
@@ -9,7 +9,7 @@
 i = 0;
 for d in v3,
   if (d != i)
-    error
+    error("failed");
   endif
   i = i + 1;
 endfor
@@ -29,7 +29,7 @@
   j = 0;
   for d in v3,
     if (d != i + j)
-      error
+      error("failed");
     endif
     j = j + 1;
   endfor
@@ -39,7 +39,7 @@
 for i=0:len(m3),
   for j=0:len(m3),
     if (m3(i,j) != i + j)
-      error
+      error("failed");
     endif
   endfor
 endfor
diff --git a/Examples/test-suite/octave/li_std_set_runme.m b/Examples/test-suite/octave/li_std_set_runme.m
index 9bd4f15..7f43f2f 100644
--- a/Examples/test-suite/octave/li_std_set_runme.m
+++ b/Examples/test-suite/octave/li_std_set_runme.m
@@ -11,15 +11,15 @@
     sum = sum + i
 
 if (sum != "abc")
-    error
+    error("failed");
 
 i = s.__iter__()
 if i.next() != "a":
-    error
+    error("failed");
 if i.next() != "b":
-    error
+    error("failed");
 if i.next() != "c":
-    error
+    error("failed");
 
 
 b = s.begin()
@@ -28,7 +28,7 @@
 while (b != e):    
     sum = sum + b.next()
 if sum != "abc":
-    error
+    error("failed");
 
 b = s.rbegin()
 e = s.rend()
@@ -37,7 +37,7 @@
     sum = sum  + b.next()
 
 if sum != "cba":
-    error
+    error("failed");
 
 
 
@@ -49,11 +49,11 @@
 i = si.__iter__()
 
 if i.next() != 1:
-    error
+    error("failed");
 if i.next() != 2:
-    error
+    error("failed");
 if i.next() != 3:
-    error
+    error("failed");
 
 
 
@@ -68,17 +68,17 @@
 while (b != e):    
     sum = sum + b.next()
 if sum != "ac":
-    error
+    error("failed");
 
 
 b = s.begin()
 e = s.end()
 if e - b != 2:
-    error
+    error("failed");
     
 m = b + 1
 if m.value() != "c":
-    error
+    error("failed");
 
 
 
@@ -93,4 +93,4 @@
     sum = sum  + (i,)
 
 if sum != (1, 'hello', (1, 2)):
-    error
+    error("failed");
diff --git a/Examples/test-suite/octave/li_std_stream_runme.m b/Examples/test-suite/octave/li_std_stream_runme.m
index bf9402e..cedc8e5 100644
--- a/Examples/test-suite/octave/li_std_stream_runme.m
+++ b/Examples/test-suite/octave/li_std_stream_runme.m
@@ -8,6 +8,6 @@
 
 
 if (o.str() !=  "A class 2345 1.435")
-  error
+  error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/li_std_string_extra_runme.m b/Examples/test-suite/octave/li_std_string_extra_runme.m
index 8d506af..15e18ee 100644
--- a/Examples/test-suite/octave/li_std_string_extra_runme.m
+++ b/Examples/test-suite/octave/li_std_string_extra_runme.m
@@ -140,23 +140,23 @@
 
 
 if (li_std_string_extra.test_reference_input("hello") != "hello")
-  error
+  error("failed");
 endif
 s = li_std_string_extra.test_reference_inout("hello");
 if (s != "hellohello")
-  error
+  error("failed");
 endif
 
 
 if (li_std_string_extra.stdstring_empty() != "")
-  error
+  error("failed");
 endif
 
 
 if (li_std_string_extra.c_empty() != "")
-  error
+  error("failed");
 endif
 
 #if (li_std_string_extra.c_null() != None)
-#  error
+#  error("failed");
 #endif
diff --git a/Examples/test-suite/octave/li_std_wstream_runme.m b/Examples/test-suite/octave/li_std_wstream_runme.m
index a017e8a..4f1c621 100644
--- a/Examples/test-suite/octave/li_std_wstream_runme.m
+++ b/Examples/test-suite/octave/li_std_wstream_runme.m
@@ -9,6 +9,6 @@
 o << a << u" " << 2345 << u" " << 1.435 << wends;
 
 if (o.str() !=  "A class 2345 1.435\0")
-  error
+  error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/multi_import_runme.m b/Examples/test-suite/octave/multi_import_runme.m
index 2b7a610..d22ff5c 100644
--- a/Examples/test-suite/octave/multi_import_runme.m
+++ b/Examples/test-suite/octave/multi_import_runme.m
@@ -8,22 +8,22 @@
 
 x = multi_import_b.XXX();
 if (x.testx() != 0)
-  error
+  error("failed");
 endif
 
 y = multi_import_b.YYY();
 if (y.testx() != 0)
-  error
+  error("failed");
 endif
 if (y.testy() != 1)
-  error
+  error("failed");
 endif
 
 z = multi_import_a.ZZZ();
 if (z.testx() != 0)
-  error
+  error("failed");
 endif
 if (z.testz() != 2)
-  error
+  error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/namespace_typemap_runme.m b/Examples/test-suite/octave/namespace_typemap_runme.m
index ca37307..d7e3381 100644
--- a/Examples/test-suite/octave/namespace_typemap_runme.m
+++ b/Examples/test-suite/octave/namespace_typemap_runme.m
@@ -1,106 +1,106 @@
 namespace_typemap
 
 if (!strcmp(stest1("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(stest2("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(stest3("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(stest4("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(stest5("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(stest6("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(stest7("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(stest8("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(stest9("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(stest10("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(stest11("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(stest12("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 c = complex(2,3);
 r = real(c);
 
 if (ctest1(c) != r)
-    error
+    error("failed");
 endif
 
 if (ctest2(c) != r)
-    error
+    error("failed");
 endif
 
 if (ctest3(c) != r)
-    error
+    error("failed");
 endif
 
 if (ctest4(c) != r)
-    error
+    error("failed");
 endif
 
 if (ctest5(c) != r)
-    error
+    error("failed");
 endif
 
 if (ctest6(c) != r)
-    error
+    error("failed");
 endif
 
 if (ctest7(c) != r)
-    error
+    error("failed");
 endif
 
 if (ctest8(c) != r)
-    error
+    error("failed");
 endif
 
 if (ctest9(c) != r)
-    error
+    error("failed");
 endif
 
 if (ctest10(c) != r)
-    error
+    error("failed");
 endif
 
 if (ctest11(c) != r)
-    error
+    error("failed");
 endif
 
 if (ctest12(c) != r)
-    error
+    error("failed");
 endif
 
 try
     ttest1(-14)
-    error
+    error("failed");
 catch
 end_try_catch
diff --git a/Examples/test-suite/octave/naturalvar_runme.m b/Examples/test-suite/octave/naturalvar_runme.m
index 6059b02..40546f2 100644
--- a/Examples/test-suite/octave/naturalvar_runme.m
+++ b/Examples/test-suite/octave/naturalvar_runme.m
@@ -14,6 +14,6 @@
 b.s = "hello";
 
 if (b.s != cvar.s)
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/overload_extend2_runme.m b/Examples/test-suite/octave/overload_extend2_runme.m
index 6db6b66..e461194 100644
--- a/Examples/test-suite/octave/overload_extend2_runme.m
+++ b/Examples/test-suite/octave/overload_extend2_runme.m
@@ -2,29 +2,29 @@
 
 f = overload_extend2.Foo();
 if (f.test(3) != 1)
-    error
+    error("failed");
 endif
 if (f.test("hello") != 2)
-    error
+    error("failed");
 endif
 if (f.test(3.5,2.5) != 3)
-    error
+    error("failed");
 endif
 if (f.test("hello",20) != 1020)
-    error
+    error("failed");
 endif
 if (f.test("hello",20,100) != 120)
-    error
+    error("failed");
 endif
 
 # C default args
 if (f.test(f) != 30)
-    error
+    error("failed");
 endif
 if (f.test(f,100) != 120)
-    error
+    error("failed");
 endif
 if (f.test(f,100,200) != 300)
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/overload_extend_c_runme.m b/Examples/test-suite/octave/overload_extend_c_runme.m
index 79b92ca..2a6c5c2 100644
--- a/Examples/test-suite/octave/overload_extend_c_runme.m
+++ b/Examples/test-suite/octave/overload_extend_c_runme.m
@@ -7,18 +7,18 @@
 
 f = overload_extend_c.Foo();
 if (f.test() != 0)
-    error
+    error("failed");
 endif
 if (f.test(3) != 1)
-    error
+    error("failed");
 endif
 if (f.test("hello") != 2)
-    error
+    error("failed");
 endif
 if (f.test(3,2) != 5)
-    error
+    error("failed");
 endif
 if (f.test(3.1)-.1 != 1003) # :)
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/overload_extend_runme.m b/Examples/test-suite/octave/overload_extend_runme.m
index d995980..a29f191 100644
--- a/Examples/test-suite/octave/overload_extend_runme.m
+++ b/Examples/test-suite/octave/overload_extend_runme.m
@@ -7,18 +7,18 @@
 
 f = overload_extend.Foo();
 if (f.test() != 0)
-    error
+    error("failed");
 endif
 if (f.test(3) != 1)
-    error
+    error("failed");
 endif
 if (f.test("hello") != 2)
-    error
+    error("failed");
 endif
 if (f.test(3,2) != 5)
-    error
+    error("failed");
 endif
 if (f.test(3.1)-.1 != 1003) # :)
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/preproc_runme.m b/Examples/test-suite/octave/preproc_runme.m
index e9af66e..80f1d32 100644
--- a/Examples/test-suite/octave/preproc_runme.m
+++ b/Examples/test-suite/octave/preproc_runme.m
@@ -6,18 +6,18 @@
 preproc
 
 if (preproc.cvar.endif != 1)
-  error
+  error("failed");
 endif
 
 if (preproc.cvar.define != 1)
-  error
+  error("failed");
 endif
 
 if (preproc.cvar.defined != 1)
-  error
+  error("failed");
 endif
 
 if (2*preproc.one != preproc.two)
-  error
+  error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/primitive_ref_runme.m b/Examples/test-suite/octave/primitive_ref_runme.m
index 68a5750..799b6db 100644
--- a/Examples/test-suite/octave/primitive_ref_runme.m
+++ b/Examples/test-suite/octave/primitive_ref_runme.m
@@ -1,53 +1,53 @@
 primitive_ref
 
 if (ref_int(3) != 3)
-    error
+    error("failed");
 endif
 
 if (ref_uint(3) != 3)
-    error
+    error("failed");
 endif
 
 if (ref_short(3) != 3)
-    error
+    error("failed");
 endif
 
 if (ref_ushort(3) != 3)
-    error
+    error("failed");
 endif
 
 if (ref_long(3) != 3)
-    error
+    error("failed");
 endif
 
 if (ref_ulong(3) != 3)
-    error
+    error("failed");
 endif
 
 if (ref_schar(3) != 3)
-    error
+    error("failed");
 endif
 
 if (ref_uchar(3) != 3)
-    error
+    error("failed");
 endif
 
 if (ref_float(3.5) != 3.5)
-    error
+    error("failed");
 endif
 
 if (ref_double(3.5) != 3.5)
-    error
+    error("failed");
 endif
 
 if (ref_bool(true) != true)
-    error
+    error("failed");
 endif
 
 if (!strcmp(ref_char('x'),'x'))
-    error
+    error("failed");
 endif
 
 if (ref_over(0) != 0)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/reference_global_vars_runme.m b/Examples/test-suite/octave/reference_global_vars_runme.m
index 67ad9c5..c7f4f56 100644
--- a/Examples/test-suite/octave/reference_global_vars_runme.m
+++ b/Examples/test-suite/octave/reference_global_vars_runme.m
@@ -2,90 +2,90 @@
 
 # const class reference variable
 if (getconstTC().num != 33)
-    error
+    error("failed");
 endif
 
 # primitive reference variables
 cvar.var_bool = createref_bool(false);
 if (value_bool(cvar.var_bool) != 0)
-    error
+    error("failed");
 endif
 
 cvar.var_bool = createref_bool(true);
 if (value_bool(cvar.var_bool) != 1)
-    error
+    error("failed");
 endif
 
 cvar.var_char = createref_char('w');
 if (!strcmp(value_char(cvar.var_char),'w'))
-    error
+    error("failed");
 endif
 
 cvar.var_unsigned_char = createref_unsigned_char(10);
 if (value_unsigned_char(cvar.var_unsigned_char) != 10)
-    error
+    error("failed");
 endif
 
 cvar.var_signed_char = createref_signed_char(10);
 if (value_signed_char(cvar.var_signed_char) != 10)
-    error
+    error("failed");
 endif
 
 cvar.var_short = createref_short(10);
 if (value_short(cvar.var_short) != 10)
-    error
+    error("failed");
 endif
 
 cvar.var_unsigned_short = createref_unsigned_short(10);
 if (value_unsigned_short(cvar.var_unsigned_short) != 10)
-    error
+    error("failed");
 endif
 
 cvar.var_int = createref_int(10);
 if (value_int(cvar.var_int) != 10)
-    error
+    error("failed");
 endif
 
 cvar.var_unsigned_int = createref_unsigned_int(10);
 if (value_unsigned_int(cvar.var_unsigned_int) != 10)
-    error
+    error("failed");
 endif
 
 cvar.var_long = createref_long(10);
 if (value_long(cvar.var_long) != 10)
-    error
+    error("failed");
 endif
 
 cvar.var_unsigned_long = createref_unsigned_long(10);
 if (value_unsigned_long(cvar.var_unsigned_long) != 10)
-    error
+    error("failed");
 endif
 
 cvar.var_long_long = createref_long_long(int64(0x6FFFFFFFFFFFFFF8));
 if (value_long_long(cvar.var_long_long) != int64(0x6FFFFFFFFFFFFFF8))
-    error
+    error("failed");
 endif
 
 #ull = abs(0xFFFFFFF2FFFFFFF0)
 ull = uint64(55834574864);
 cvar.var_unsigned_long_long = createref_unsigned_long_long(ull);
 if (value_unsigned_long_long(cvar.var_unsigned_long_long) != ull)
-    error
+    error("failed");
 endif
 
 cvar.var_float = createref_float(10.5);
 if (value_float(cvar.var_float) != 10.5)
-    error
+    error("failed");
 endif
 
 cvar.var_double = createref_double(10.5);
 if (value_double(cvar.var_double) != 10.5)
-    error
+    error("failed");
 endif
 
 # class reference variable
 cvar.var_TestClass = createref_TestClass(TestClass(20));
 if (value_TestClass(cvar.var_TestClass).num != 20)
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/rename_scope_runme.m b/Examples/test-suite/octave/rename_scope_runme.m
index 154f99d..776d218 100644
--- a/Examples/test-suite/octave/rename_scope_runme.m
+++ b/Examples/test-suite/octave/rename_scope_runme.m
@@ -4,11 +4,11 @@
 b = Natural_BP();
 
 if (a.rtest() != 1)
-    error
+    error("failed");
 endif
 
 if (b.rtest() != 1)
-    error
+    error("failed");
 endif
 
 f = @equals;
diff --git a/Examples/test-suite/octave/ret_by_value_runme.m b/Examples/test-suite/octave/ret_by_value_runme.m
index 67f80aa..c1c5083 100644
--- a/Examples/test-suite/octave/ret_by_value_runme.m
+++ b/Examples/test-suite/octave/ret_by_value_runme.m
@@ -7,9 +7,9 @@
 
 a = ret_by_value.get_test();
 if (a.myInt != 100)
-    error
+    error("failed");
 endif
 
 if (a.myShort != 200)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/smart_pointer_extend_runme.m b/Examples/test-suite/octave/smart_pointer_extend_runme.m
index 6c9258e..cf82f73 100644
--- a/Examples/test-suite/octave/smart_pointer_extend_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_extend_runme.m
@@ -9,7 +9,7 @@
 b = Bar(f);
 
 if (b.extension() != f.extension())
-  error
+  error("failed");
 endif
 
 
@@ -18,15 +18,15 @@
 p = CPtr();
 
 if (b.bar() != p.bar())
-  error
+  error("failed");
 endif
 
 if (d.foo() != p.foo())
-  error
+  error("failed");
 endif
 
 if (b.hello() != p.hello())
-  error
+  error("failed");
 endif
 
 
@@ -36,11 +36,11 @@
 dp = DPtrFoo(d);
 
 if (d.SExt(1) != dp.SExt(1))
-  error
+  error("failed");
 endif
 
 if (d.Ext(1) != dp.Ext(1))
-  error
+  error("failed");
 endif
 
   
diff --git a/Examples/test-suite/octave/smart_pointer_member_runme.m b/Examples/test-suite/octave/smart_pointer_member_runme.m
index 30251c3..1c2d0e9 100644
--- a/Examples/test-suite/octave/smart_pointer_member_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_member_runme.m
@@ -4,7 +4,7 @@
 f.y = 1;
 
 if (f.y != 1)
-  error
+  error("failed");
 endif
 
 b = Bar(f);
@@ -15,18 +15,18 @@
 endif
 
 if (swig_this(b.x) != swig_this(f.x))
-  error
+  error("failed");
 endif
 
 if (b.z != f.z)
-  error
+  error("failed");
 endif
 
 try
   if (Foo.z == Bar.z)
-    error
+    error("failed");
   endif
-    error
+    error("failed");
 catch
 end_try_catch
 
diff --git a/Examples/test-suite/octave/smart_pointer_multi_runme.m b/Examples/test-suite/octave/smart_pointer_multi_runme.m
index 71ef910..ea15d04 100644
--- a/Examples/test-suite/octave/smart_pointer_multi_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_multi_runme.m
@@ -7,11 +7,11 @@
 
 s.x = 3;
 if (s.getx() != 3)
-    error
+    error("failed");
 endif
 
 g.x = 4;
 if (g.getx() != 4)
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m b/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m
index 4b77e0e..c2ab787 100644
--- a/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_multi_typedef_runme.m
@@ -7,12 +7,12 @@
 
 s.x = 3;
 if (s.getx() != 3)
-    error
+    error("failed");
 endif
 
 g.x = 4;
 if (g.getx() != 4)
-    error
+    error("failed");
 endif
 
 
diff --git a/Examples/test-suite/octave/smart_pointer_overload_runme.m b/Examples/test-suite/octave/smart_pointer_overload_runme.m
index a5df0de..1bfb683 100644
--- a/Examples/test-suite/octave/smart_pointer_overload_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_overload_runme.m
@@ -10,23 +10,23 @@
 
 
 if (f.test(3) != 1)
-    error
+    error("failed");
 endif
 if (f.test(3.5) != 2)
-    error
+    error("failed");
 endif
 if (f.test("hello") != 3)
-    error
+    error("failed");
 endif
 
 if (b.test(3) != 1)
-    error
+    error("failed");
 endif
 if (b.test(3.5) != 2)
-    error
+    error("failed");
 endif
 if (b.test("hello") != 3)
-    error
+    error("failed");
 endif
 
 
diff --git a/Examples/test-suite/octave/smart_pointer_rename_runme.m b/Examples/test-suite/octave/smart_pointer_rename_runme.m
index 5eb6d4c..307bd8f 100644
--- a/Examples/test-suite/octave/smart_pointer_rename_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_rename_runme.m
@@ -9,14 +9,14 @@
 b = Bar(f);
 
 if (b.test() != 3)
-    error
+    error("failed");
 endif
 
 if (b.ftest1(1) != 1)
-    error
+    error("failed");
 endif
 
 if (b.ftest2(2,3) != 2)
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/smart_pointer_simple_runme.m b/Examples/test-suite/octave/smart_pointer_simple_runme.m
index 30b1387..c15c43c 100644
--- a/Examples/test-suite/octave/smart_pointer_simple_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_simple_runme.m
@@ -10,11 +10,11 @@
 
 b.x = 3;
 if (b.getx() != 3)
-    error
+    error("failed");
 endif
 
 fp = b.__deref__();
 fp.x = 4;
 if (fp.getx() != 4)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m b/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m
index 4884fa2..ee45f68 100644
--- a/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_templatevariables_runme.m
@@ -3,17 +3,17 @@
 d = DiffImContainerPtr_D(create(1234, 5678));
 
 if (d.id != 1234)
-  error
+  error("failed");
 endif
 #if (d.xyz != 5678):
-#  error
+#  error("failed");
 
 d.id = 4321;
 #d.xyz = 8765
 
 if (d.id != 4321)
-  error
+  error("failed");
 endif
 #if (d.xyz != 8765):
-#  error
+#  error("failed");
 
diff --git a/Examples/test-suite/octave/smart_pointer_typedef_runme.m b/Examples/test-suite/octave/smart_pointer_typedef_runme.m
index 0e1c8a6..3a09467 100644
--- a/Examples/test-suite/octave/smart_pointer_typedef_runme.m
+++ b/Examples/test-suite/octave/smart_pointer_typedef_runme.m
@@ -10,11 +10,11 @@
 
 b.x = 3;
 if (b.getx() != 3)
-    error
+    error("failed");
 endif
 
 fp = b.__deref__();
 fp.x = 4;
 if (fp.getx() != 4)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/static_const_member_2_runme.m b/Examples/test-suite/octave/static_const_member_2_runme.m
index 73260ba..8619fd1 100644
--- a/Examples/test-suite/octave/static_const_member_2_runme.m
+++ b/Examples/test-suite/octave/static_const_member_2_runme.m
@@ -18,6 +18,6 @@
 
 
 if (Foo.BAZ.val != 2*Foo.BAR.val)
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/std_containers_runme.m b/Examples/test-suite/octave/std_containers_runme.m
index eae3d5d..d069b58 100644
--- a/Examples/test-suite/octave/std_containers_runme.m
+++ b/Examples/test-suite/octave/std_containers_runme.m
@@ -132,7 +132,7 @@
 j=1;
 for i in s,
   if (i != j)
-    error
+    error("failed");
   endif
   j = j + 1;
 endfor
diff --git a/Examples/test-suite/octave/struct_value_runme.m b/Examples/test-suite/octave/struct_value_runme.m
index ff34404..7f7448b 100644
--- a/Examples/test-suite/octave/struct_value_runme.m
+++ b/Examples/test-suite/octave/struct_value_runme.m
@@ -9,10 +9,10 @@
 
 b.a.x = 3;
 if (b.a.x != 3)
-  error
+  error("failed");
 endif
 
 b.b.x = 3;
 if (b.b.x != 3)
-  error
+  error("failed");
 endif
diff --git a/Examples/test-suite/octave/swigobject_runme.m b/Examples/test-suite/octave/swigobject_runme.m
index 73167e4..9ab3aa8 100644
--- a/Examples/test-suite/octave/swigobject_runme.m
+++ b/Examples/test-suite/octave/swigobject_runme.m
@@ -11,7 +11,7 @@
 a2 = a_ptr(a);
 
 if (swig_this(a1) != swig_this(a2))
-  error
+  error("failed");
 endif
   
 
@@ -20,7 +20,7 @@
 xstr2 = pointer_str(a);
 
 if (xstr1 != xstr2)
-  error
+  error("failed");
 endif
 
 s = str(a.this);
@@ -29,5 +29,5 @@
 v1 = v_ptr(a);
 v2 = v_ptr(a);
 if (uint64(v1) != uint64(v2))
-  error
+  error("failed");
 endif
diff --git a/Examples/test-suite/octave/template_extend1_runme.m b/Examples/test-suite/octave/template_extend1_runme.m
index 5035deb..05e5341 100644
--- a/Examples/test-suite/octave/template_extend1_runme.m
+++ b/Examples/test-suite/octave/template_extend1_runme.m
@@ -9,9 +9,9 @@
 b = template_extend1.dBaz();
 
 if (!strcmp(a.foo(),"lBaz::foo"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(b.foo(),"dBaz::foo"))
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/template_extend2_runme.m b/Examples/test-suite/octave/template_extend2_runme.m
index 24472a9..e9b5fb7 100644
--- a/Examples/test-suite/octave/template_extend2_runme.m
+++ b/Examples/test-suite/octave/template_extend2_runme.m
@@ -9,9 +9,9 @@
 b = template_extend2.dBaz();
 
 if (!strcmp(a.foo(),"lBaz::foo"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(b.foo(),"dBaz::foo"))
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/template_inherit_runme.m b/Examples/test-suite/octave/template_inherit_runme.m
index 368cce2..72d7e75 100644
--- a/Examples/test-suite/octave/template_inherit_runme.m
+++ b/Examples/test-suite/octave/template_inherit_runme.m
@@ -12,62 +12,62 @@
 f = BarUInt();
 
 if (!strcmp(a.blah(),"Foo"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(b.blah(),"Foo"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(e.blah(),"Foo"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(c.blah(),"Bar"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(d.blah(),"Bar"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(f.blah(),"Bar"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(c.foomethod(),"foomethod"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(d.foomethod(),"foomethod"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(f.foomethod(),"foomethod"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(invoke_blah_int(a),"Foo"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(invoke_blah_int(c),"Bar"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(invoke_blah_double(b),"Foo"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(invoke_blah_double(d),"Bar"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(invoke_blah_uint(e),"Foo"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(invoke_blah_uint(f),"Bar"))
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/template_ns4_runme.m b/Examples/test-suite/octave/template_ns4_runme.m
index b574642..6dff556 100644
--- a/Examples/test-suite/octave/template_ns4_runme.m
+++ b/Examples/test-suite/octave/template_ns4_runme.m
@@ -7,5 +7,5 @@
 
 d = make_Class_DD();
 if (!strcmp(d.test(),"test"))
-  error
+  error("failed");
 endif
diff --git a/Examples/test-suite/octave/template_ns_runme.m b/Examples/test-suite/octave/template_ns_runme.m
index 29a2f53..44b13e6 100644
--- a/Examples/test-suite/octave/template_ns_runme.m
+++ b/Examples/test-suite/octave/template_ns_runme.m
@@ -3,19 +3,19 @@
 p2 = pairii(p1);
 
 if (p2.first != 2)
-    error
+    error("failed");
 endif
 if (p2.second != 3)
-    error
+    error("failed");
 endif
 
 p3 = pairdd(3.5,2.5);
 p4 = pairdd(p3);
 
 if (p4.first != 3.5)
-    error
+    error("failed");
 endif
 
 if (p4.second != 2.5)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/template_tbase_template_runme.m b/Examples/test-suite/octave/template_tbase_template_runme.m
index da8ec4c..b1bfd8f7 100644
--- a/Examples/test-suite/octave/template_tbase_template_runme.m
+++ b/Examples/test-suite/octave/template_tbase_template_runme.m
@@ -2,5 +2,5 @@
 
 a = make_Class_dd();
 if (!strcmp(a.test(),"test"))
-  error
+  error("failed");
 endif
diff --git a/Examples/test-suite/octave/template_typedef_cplx2_runme.m b/Examples/test-suite/octave/template_typedef_cplx2_runme.m
index a72e0f1..eb783fe 100644
--- a/Examples/test-suite/octave/template_typedef_cplx2_runme.m
+++ b/Examples/test-suite/octave/template_typedef_cplx2_runme.m
@@ -15,7 +15,7 @@
 if (strfind('ArithUnaryFunction',swig_type(d)) != 1)
   d
   error("is not an ArithUnaryFunction")
-  error
+  error("failed");
 endif
 
 try
@@ -77,7 +77,7 @@
 if (strfind('ArithUnaryFunction',swig_type(g)) != 1)
   g
   error("is not an ArithUnaryFunction")
-  error
+  error("failed");
 endif
 
 
@@ -98,6 +98,6 @@
   a = g.get_value();
 catch
   error(g, "has not get_value() method")
-  error
+  error("failed");
 end_try_catch
 
diff --git a/Examples/test-suite/octave/template_typedef_runme.m b/Examples/test-suite/octave/template_typedef_runme.m
index 8d8af79..2a734e2 100644
--- a/Examples/test-suite/octave/template_typedef_runme.m
+++ b/Examples/test-suite/octave/template_typedef_runme.m
@@ -8,7 +8,7 @@
   a = swig_this(d);
   a = swig_this(c);
 catch
-  error
+  error("failed");
 end_try_catch
 
 try
@@ -37,15 +37,15 @@
 
 # the old large format
 if (strcmp("<unknown>",swig_typequery("vfncs::ArithUnaryFunction<vfncs::arith_traits<float,double>::argument_type,vfncs::arith_traits<float,double >::result_type > *")))
-  error
+  error("failed");
 endif
 
 # the reduced format
 if (strcmp("<unknown>",swig_typequery("vfncs::ArithUnaryFunction<double,double> *")))
-  error
+  error("failed");
 endif
 
 # this is a bad name
 if (!strcmp("<unknown>",swig_typequery("vfncs::ArithUnaryFunction<double,doublex> *")))
-  error
+  error("failed");
 endif
diff --git a/Examples/test-suite/octave/typemap_namespace_runme.m b/Examples/test-suite/octave/typemap_namespace_runme.m
index ec62a39..e67781c 100644
--- a/Examples/test-suite/octave/typemap_namespace_runme.m
+++ b/Examples/test-suite/octave/typemap_namespace_runme.m
@@ -1,10 +1,10 @@
 typemap_namespace
 
 if (!strcmp(test1("hello"),"hello"))
-    error
+    error("failed");
 endif
 
 if (!strcmp(test2("hello"),"hello"))
-    error
+    error("failed");
 endif
 
diff --git a/Examples/test-suite/octave/typemap_ns_using_runme.m b/Examples/test-suite/octave/typemap_ns_using_runme.m
index dd3f657..d94241b 100644
--- a/Examples/test-suite/octave/typemap_ns_using_runme.m
+++ b/Examples/test-suite/octave/typemap_ns_using_runme.m
@@ -1,5 +1,5 @@
 typemap_ns_using
 
 if (typemap_ns_using.spam(37) != 37)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/types_directive_runme.m b/Examples/test-suite/octave/types_directive_runme.m
index 0757c6c..5ad4af1 100644
--- a/Examples/test-suite/octave/types_directive_runme.m
+++ b/Examples/test-suite/octave/types_directive_runme.m
@@ -3,13 +3,13 @@
 d1 = Time1(2001, 2, 3, 60);
 newDate = add(d1, 7); # check that a Time1 instance is accepted where Date is expected
 if (newDate.day != 10)
-  error
+  error("failed");
 endif
 
 d2 = Time2(1999, 8, 7, 60);
 newDate = add(d2, 7); # check that a Time2 instance is accepted where Date is expected
 if (newDate.day != 14)
-  error
+  error("failed");
 endif
 
 
diff --git a/Examples/test-suite/octave/using1_runme.m b/Examples/test-suite/octave/using1_runme.m
index 9253a1d..e25128e 100644
--- a/Examples/test-suite/octave/using1_runme.m
+++ b/Examples/test-suite/octave/using1_runme.m
@@ -6,5 +6,5 @@
 using1
 
 if (using1.spam(37) != 37)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/using2_runme.m b/Examples/test-suite/octave/using2_runme.m
index 7cc6689..0213ee7 100644
--- a/Examples/test-suite/octave/using2_runme.m
+++ b/Examples/test-suite/octave/using2_runme.m
@@ -6,5 +6,5 @@
 using2
 
 if (using2.spam(37) != 37)
-    error
+    error("failed");
 endif
diff --git a/Examples/test-suite/octave/virtual_poly_runme.m b/Examples/test-suite/octave/virtual_poly_runme.m
index 0c7c951..363f867 100644
--- a/Examples/test-suite/octave/virtual_poly_runme.m
+++ b/Examples/test-suite/octave/virtual_poly_runme.m
@@ -10,23 +10,23 @@
 ic = i.copy();
 
 if (d.get() != dc.get())
-  error
+  error("failed");
 endif
 
 if (i.get() != ic.get())
-  error
+  error("failed");
 endif
 
 virtual_poly.incr(ic);
 
 if ((i.get() + 1) != ic.get())
-  error
+  error("failed");
 endif
 
 
 dr = d.ref_this();
 if (d.get() != dr.get())
-  error
+  error("failed");
 endif
 
 
@@ -35,10 +35,10 @@
 #
 ddc = virtual_poly.NDouble_narrow(d.nnumber());
 if (d.get() != ddc.get())
-  error
+  error("failed");
 endif
 
 dic = virtual_poly.NInt_narrow(i.nnumber());
 if (i.get() != dic.get())
-  error
+  error("failed");
 endif
diff --git a/Examples/test-suite/octave/voidtest_runme.m b/Examples/test-suite/octave/voidtest_runme.m
index fb411ee..c4815a5 100644
--- a/Examples/test-suite/octave/voidtest_runme.m
+++ b/Examples/test-suite/octave/voidtest_runme.m
@@ -27,16 +27,16 @@
 v1 = voidtest.vfunc1(f);
 v2 = voidtest.vfunc2(f);
 if (swig_this(v1) != swig_this(v2))
-    error
+    error("failed");
 endif
 
 v3 = voidtest.vfunc3(v1);
 if (swig_this(v3) != swig_this(f))
-    error
+    error("failed");
 endif
 v4 = voidtest.vfunc1(f);
 if (swig_this(v4) != swig_this(v1))
-    error
+    error("failed");
 endif
 
 
diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in
index 86d5e37..7ca98b3 100644
--- a/Examples/test-suite/python/Makefile.in
+++ b/Examples/test-suite/python/Makefile.in
@@ -10,20 +10,10 @@
 
 LANGUAGE     = python
 PYTHON       = $(PYBIN)
+SCRIPTSUFFIX = _runme.py
 PYCODESTYLE       = @PYCODESTYLE@
 PYCODESTYLE_FLAGS = --ignore=E252,E30,E402,E501,E731,E741,W291,W391
 
-#*_runme.py for Python 2.x, *_runme3.py for Python 3.x
-PY2SCRIPTSUFFIX = _runme.py
-PY3SCRIPTSUFFIX = _runme3.py
-PY2TO3       = @PY2TO3@ -x import
-
-ifeq (,$(PY3))
-  SCRIPTSUFFIX = $(PY2SCRIPTSUFFIX)
-else
-  SCRIPTSUFFIX = $(PY3SCRIPTSUFFIX)
-endif
-
 srcdir       = @srcdir@
 top_srcdir   = @top_srcdir@
 top_builddir = @top_builddir@
@@ -85,6 +75,7 @@
 	cpp11_shared_ptr_const \
 	cpp11_shared_ptr_nullptr_in_containers \
 	cpp11_shared_ptr_overload \
+	cpp11_shared_ptr_template_upcast \
 	cpp11_shared_ptr_upcast \
 	cpp11_std_unordered_map \
 	cpp11_std_unordered_multimap \
@@ -108,7 +99,6 @@
 include $(srcdir)/../common.mk
 
 # Overridden variables here
-SCRIPTDIR    = .
 LIBS         = -L.
 VALGRIND_OPT += --suppressions=pythonswig.supp
 
@@ -117,35 +107,25 @@
 
 # Rules for the different types of tests
 %.cpptest:
-	+$(convert_testcase)
 	$(setup)
 	+$(swig_and_compile_cpp)
 	$(check_pep8)
 	$(run_testcase)
 
 %.ctest:
-	+$(convert_testcase)
 	$(setup)
 	+$(swig_and_compile_c)
 	$(check_pep8)
 	$(run_testcase)
 
 %.multicpptest:
-	+$(convert_testcase)
 	$(setup)
 	+$(swig_and_compile_multi_cpp)
 	$(check_pep8_multi_cpp)
 	$(run_testcase)
 
 
-
-# Runs the testcase. A testcase is only run if
-# a file is found which has _runme.py (or _runme3.py for Python 3) appended after the testcase name.
-
-py_runme  = $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)
-py2_runme = $(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX)
-py3_runme = $(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX)
-
+# Python code style checking
 ifneq (,$(PYCODESTYLE))
 check_pep8 = $(COMPILETOOL) $(PYCODESTYLE) $(PYCODESTYLE_FLAGS) $(SCRIPTPREFIX)$*.py
 
@@ -155,70 +135,16 @@
 	done
 endif
 
-run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(py_runme)
-
+# Runs the testcase. A testcase is only run if
+# a file is found which has _runme.py appended after the testcase name.
 run_testcase = \
-	if [ -f $(SCRIPTDIR)/$(py_runme) ]; then \
-	  $(run_python);\
+	if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \
+	  env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \
 	fi
 
-# Grab runme file ready for running: copied for out of source tree builds, and/or run 2to3
-# Note terminal (double colon) rules creating runme files to fix possible infinite recursion,
-# see https://github.com/swig/swig/pull/688
-ifeq ($(SCRIPTDIR),$(srcdir))
-  # in source tree build
-  ifeq (,$(PY3))
-    convert_testcase =
-  else
-    convert_testcase = \
-	if [ -f $(srcdir)/$(py2_runme) ]; then \
-	  $(MAKE) $(SCRIPTDIR)/$(py_runme); \
-	fi
-
-# For converting python 2 tests into Python 3 tests
-$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX):: $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX)
-	cp $< $@
-	$(PY2TO3) -w $@ >/dev/null 2>&1
-
-  endif
-else
-  # out of source tree build
-  ifeq (,$(PY3))
-    convert_testcase = \
-	if [ -f $(srcdir)/$(py2_runme) ]; then \
-	  $(MAKE) $(SCRIPTDIR)/$(py_runme); \
-	fi
-
-$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX):: $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX)
-	cp $< $@
-
-  else
-    convert_testcase = \
-	if [ -f $(srcdir)/$(py2_runme) ]; then \
-	  $(MAKE) $(SCRIPTDIR)/$(py_runme); \
-	elif [ -f $(srcdir)/$(py3_runme) ]; then \
-	  $(MAKE) $(SCRIPTDIR)/$(py3_runme); \
-	fi
-
-# For when there is a _runme3.py instead of a _runme.py, ie a Python 3 only run test
-$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX):: $(srcdir)/$(SCRIPTPREFIX)%$(PY3SCRIPTSUFFIX)
-	cp $< $@
-
-# For converting python 2 tests into Python 3 tests
-$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX):: $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX)
-	cp $< $@
-	$(PY2TO3) -w $@ >/dev/null 2>&1
-
-  endif
-
-endif
-
 # Clean: remove the generated .py file
-# We only remove the _runme3.py if it is generated by 2to3 from a _runme.py.
 %.clean:
 	@rm -f $*.py
-	@if test -f $(srcdir)/$(py2_runme); then rm -f $(SCRIPTDIR)/$(py3_runme) $(SCRIPTDIR)/$(py3_runme).bak; fi
-	@if test "x$(SCRIPTDIR)" != "x$(srcdir)"; then rm -f $(SCRIPTDIR)/$(py_runme); fi
 
 clean:
 	$(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR='$(SRCDIR)' python_clean
diff --git a/Examples/test-suite/python/argcargvtest_runme.py b/Examples/test-suite/python/argcargvtest_runme.py
index b034574..eb57f79 100644
--- a/Examples/test-suite/python/argcargvtest_runme.py
+++ b/Examples/test-suite/python/argcargvtest_runme.py
@@ -6,7 +6,6 @@
 
 targs = ("hi", "hola")
 if mainv(targs, 1) != "hola":
-    print(mainv(targs, 1))
     raise RuntimeError("bad main typemap")
 
 targs = ("hi", "hola")
diff --git a/Examples/test-suite/python/array_member_runme.py b/Examples/test-suite/python/array_member_runme.py
index de6e0f3..2708a6f 100644
--- a/Examples/test-suite/python/array_member_runme.py
+++ b/Examples/test-suite/python/array_member_runme.py
@@ -5,7 +5,7 @@
 
 for i in range(0, 8):
     if get_value(f.data, i) != get_value(cvar.global_data, i):
-        raise RuntimeError, "Bad array assignment"
+        raise RuntimeError("Bad array assignment")
 
 
 for i in range(0, 8):
@@ -15,4 +15,4 @@
 
 for i in range(0, 8):
     if get_value(f.data, i) != get_value(cvar.global_data, i):
-        raise RuntimeError, "Bad array assignment"
+        raise RuntimeError("Bad array assignment")
diff --git a/Examples/test-suite/python/char_binary_runme.py b/Examples/test-suite/python/char_binary_runme.py
index 0425fe1..39c0b24 100644
--- a/Examples/test-suite/python/char_binary_runme.py
+++ b/Examples/test-suite/python/char_binary_runme.py
@@ -2,16 +2,14 @@
 
 t = Test()
 if t.strlen("hile") != 4:
-    print t.strlen("hile")
-    raise RuntimeError, "bad multi-arg typemap"
+    raise RuntimeError("bad multi-arg typemap {}".format(t.strlen("hile")))
 if t.ustrlen("hile") != 4:
-    print t.ustrlen("hile")
-    raise RuntimeError, "bad multi-arg typemap"
+    raise RuntimeError("bad multi-arg typemap {}".format(t.ustrlen("hile")))
 
 if t.strlen("hil\0") != 4:
-    raise RuntimeError, "bad multi-arg typemap"
+    raise RuntimeError("bad multi-arg typemap")
 if t.ustrlen("hil\0") != 4:
-    raise RuntimeError, "bad multi-arg typemap"
+    raise RuntimeError("bad multi-arg typemap")
 
 #
 # creating a raw char*
@@ -25,18 +23,17 @@
 
 
 if t.strlen(pc) != 4:
-    raise RuntimeError, "bad multi-arg typemap"
+    raise RuntimeError("bad multi-arg typemap")
 if t.ustrlen(pc) != 4:
-    raise RuntimeError, "bad multi-arg typemap"
+    raise RuntimeError("bad multi-arg typemap")
 
 cvar.var_pchar = pc
 if cvar.var_pchar != "hola":
-    print cvar.var_pchar
-    raise RuntimeError, "bad pointer case"
+    raise RuntimeError("bad pointer case {}".format(cvar.var_pchar))
 
 cvar.var_namet = pc
 # if cvar.var_namet != "hola\0":
 if cvar.var_namet != "hola":
-    raise RuntimeError, "bad pointer case"
+    raise RuntimeError("bad pointer case")
 
 delete_pchar(pc)
diff --git a/Examples/test-suite/python/complextest_runme.py b/Examples/test-suite/python/complextest_runme.py
index 53b2b8d..4e7d08f 100644
--- a/Examples/test-suite/python/complextest_runme.py
+++ b/Examples/test-suite/python/complextest_runme.py
@@ -3,24 +3,32 @@
 a = complex(-1, 2)
 
 if complextest.Conj(a) != a.conjugate():
-    raise RuntimeError, "bad complex mapping"
+    raise RuntimeError("bad complex mapping")
 
 if complextest.Conjf(a) != a.conjugate():
-    raise RuntimeError, "bad complex mapping"
+    raise RuntimeError("bad complex mapping")
 
 if complextest.Conj2(a) != a.conjugate():
-    raise RuntimeError, "bad complex mapping"
+    raise RuntimeError("bad complex mapping")
 
 if complextest.Conjf2(a) != a.conjugate():
-    raise RuntimeError, "bad complex mapping"
+    raise RuntimeError("bad complex mapping")
 
 if 'Conj3' in dir(complextest):
     if complextest.Conj3(a) != a.conjugate():
-        raise RuntimeError, "bad complex mapping"
+        raise RuntimeError("bad complex mapping")
 
 if 'Conjf3' in dir(complextest):
     if complextest.Conjf3(a) != a.conjugate():
-        raise RuntimeError, "bad complex mapping"
+        raise RuntimeError("bad complex mapping")
+
+if 'Conj4' in dir(complextest):
+    if complextest.Conj4(a) != a.conjugate():
+        raise RuntimeError("bad complex mapping")
+
+if 'Conj5' in dir(complextest):
+    if complextest.Conj5(a) != a.conjugate():
+        raise RuntimeError("bad complex mapping")
 
 if 'CopyHalf' in dir(complextest):
 
@@ -36,4 +44,4 @@
     p.z1 = complex(0, 1)
     p.z2 = complex(0, -1)
     if complextest.Conj(p.z2) != p.z1:
-        raise RuntimeError, "bad complex mapping"
+        raise RuntimeError("bad complex mapping")
diff --git a/Examples/test-suite/python/constover_runme.py b/Examples/test-suite/python/constover_runme.py
index 2d28a55..0c03967 100644
--- a/Examples/test-suite/python/constover_runme.py
+++ b/Examples/test-suite/python/constover_runme.py
@@ -4,33 +4,26 @@
 
 p = constover.test("test")
 if p != "test":
-    print "test failed!"
-    error = 1
+    raise RuntimeError("test failed!")
 
 p = constover.test_pconst("test")
 if p != "test_pconst":
-    print "test_pconst failed!"
-    error = 1
+    raise RuntimeError("test_pconst failed!")
 
 f = constover.Foo()
 p = f.test("test")
 if p != "test":
-    print "member-test failed!"
-    error = 1
+    raise RuntimeError("member-test failed!")
 
 p = f.test_pconst("test")
 if p != "test_pconst":
-    print "member-test_pconst failed!"
-    error = 1
+    raise RuntimeError("member-test_pconst failed!")
 
 p = f.test_constm("test")
 if p != "test_constmethod":
-    print "member-test_constm failed!"
-    error = 1
+    raise RuntimeError("member-test_constm failed!")
 
 p = f.test_pconstm("test")
 if p != "test_pconstmethod":
-    print "member-test_pconstm failed!"
-    error = 1
+    raise RuntimeError("member-test_pconstm failed!")
 
-sys.exit(error)
diff --git a/Examples/test-suite/python/contract_runme.py b/Examples/test-suite/python/contract_runme.py
index cd75a51..b6bab3a 100644
--- a/Examples/test-suite/python/contract_runme.py
+++ b/Examples/test-suite/python/contract_runme.py
@@ -2,141 +2,141 @@
 
 contract.test_preassert(1, 2)
 try:
-    contract.test_preassert(-1)
-    print "Failed! Preassertions are broken"
-except:
+    contract.test_preassert(-1, 3)
+    raise Exception("Failed! Preassertions are broken")
+except RuntimeError:
     pass
 
 contract.test_postassert(3)
 try:
     contract.test_postassert(-3)
-    print "Failed! Postassertions are broken"
-except:
+    raise Exception("Failed! Postassertions are broken")
+except RuntimeError:
     pass
 
 contract.test_prepost(2, 3)
 contract.test_prepost(5, -4)
 try:
     contract.test_prepost(-3, 4)
-    print "Failed! Preassertions are broken"
-except:
+    raise Exception("Failed! Preassertions are broken")
+except RuntimeError:
     pass
 
 try:
     contract.test_prepost(4, -10)
-    print "Failed! Postassertions are broken"
+    raise Exception("Failed! Postassertions are broken")
 
-except:
+except RuntimeError:
     pass
 
 f = contract.Foo()
 f.test_preassert(4, 5)
 try:
     f.test_preassert(-2, 3)
-    print "Failed! Method preassertion."
-except:
+    raise Exception("Failed! Method preassertion.")
+except RuntimeError:
     pass
 
 f.test_postassert(4)
 try:
     f.test_postassert(-4)
-    print "Failed! Method postassertion"
-except:
+    raise Exception("Failed! Method postassertion")
+except RuntimeError:
     pass
 
 f.test_prepost(3, 4)
 f.test_prepost(4, -3)
 try:
     f.test_prepost(-4, 2)
-    print "Failed! Method preassertion."
-except:
+    raise Exception("Failed! Method preassertion.")
+except RuntimeError:
     pass
 
 try:
     f.test_prepost(4, -10)
-    print "Failed! Method postassertion."
-except:
+    raise Exception("Failed! Method postassertion.")
+except RuntimeError:
     pass
 
 contract.Foo_stest_prepost(4, 0)
 try:
     contract.Foo_stest_prepost(-4, 2)
-    print "Failed! Static method preassertion"
-except:
+    raise Exception("Failed! Static method preassertion")
+except RuntimeError:
     pass
 
 try:
     contract.Foo_stest_prepost(4, -10)
-    print "Failed! Static method posteassertion"
-except:
+    raise Exception("Failed! Static method posteassertion")
+except RuntimeError:
     pass
 
 b = contract.Bar()
 try:
     b.test_prepost(2, -4)
-    print "Failed! Inherited preassertion."
-except:
+    raise Exception("Failed! Inherited preassertion.")
+except RuntimeError:
     pass
 
 
 d = contract.D()
 try:
     d.foo(-1, 1, 1, 1, 1)
-    print "Failed! Inherited preassertion (D)."
-except:
+    raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
     pass
 try:
     d.foo(1, -1, 1, 1, 1)
-    print "Failed! Inherited preassertion (D)."
-except:
+    raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
     pass
 try:
     d.foo(1, 1, -1, 1, 1)
-    print "Failed! Inherited preassertion (D)."
-except:
+    raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
     pass
 try:
     d.foo(1, 1, 1, -1, 1)
-    print "Failed! Inherited preassertion (D)."
-except:
+    raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
     pass
 try:
     d.foo(1, 1, 1, 1, -1)
-    print "Failed! Inherited preassertion (D)."
-except:
+    raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
     pass
 
 
 try:
     d.bar(-1, 1, 1, 1, 1)
-    print "Failed! Inherited preassertion (D)."
-except:
+    raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
     pass
 try:
     d.bar(1, -1, 1, 1, 1)
-    print "Failed! Inherited preassertion (D)."
-except:
+    raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
     pass
 try:
     d.bar(1, 1, -1, 1, 1)
-    print "Failed! Inherited preassertion (D)."
-except:
+    raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
     pass
 try:
     d.bar(1, 1, 1, -1, 1)
-    print "Failed! Inherited preassertion (D)."
-except:
+    raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
     pass
 try:
     d.bar(1, 1, 1, 1, -1)
-    print "Failed! Inherited preassertion (D)."
-except:
+    raise Exception("Failed! Inherited preassertion (D).")
+except RuntimeError:
     pass
 
 # Namespace
 my = contract.myClass(1)
 try:
     my = contract.myClass(0)
-    print "Failed! constructor preassertion"
-except:
+    raise Exception("Failed! constructor preassertion")
+except RuntimeError:
     pass
diff --git a/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py b/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py
index cc7b5cd..e46a477 100644
--- a/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py
+++ b/Examples/test-suite/python/cpp11_alternate_function_syntax_runme.py
@@ -4,20 +4,20 @@
 
 res = a.addNormal(4, 5)
 if res != 9:
-    raise RuntimeError, ("SomeStruct::addNormal(4,5) returns ", res, " should be 9.")
+    raise RuntimeError("SomeStruct::addNormal(4,5) returns ", res, " should be 9.")
 
 res = a.addAlternate(4, 5)
 if res != 9:
-    raise RuntimeError, ("SomeStruct::addAlternate(4,5) returns ", res, " should be 9.")
+    raise RuntimeError("SomeStruct::addAlternate(4,5) returns ", res, " should be 9.")
 
 res = a.addAlternateConst(4, 5)
 if res != 9:
-    raise RuntimeError, ("SomeStruct::addAlternateConst(4,5) returns ", res, " should be 9.")
+    raise RuntimeError("SomeStruct::addAlternateConst(4,5) returns ", res, " should be 9.")
 
 res = a.addAlternateNoExcept(4, 5)
 if res != 9:
-    raise RuntimeError, ("SomeStruct::addAlternateNoExcept(4,5) returns ", res, " should be 9.")
+    raise RuntimeError("SomeStruct::addAlternateNoExcept(4,5) returns ", res, " should be 9.")
 
 res = a.addAlternateConstNoExcept(4, 5)
 if res != 9:
-    raise RuntimeError, ("SomeStruct::addAlternateConstNoExcept(4,5) returns ", res, " should be 9.")
+    raise RuntimeError("SomeStruct::addAlternateConstNoExcept(4,5) returns ", res, " should be 9.")
diff --git a/Examples/test-suite/python/cpp11_decltype_runme.py b/Examples/test-suite/python/cpp11_decltype_runme.py
index 1650d90..a18f334 100644
--- a/Examples/test-suite/python/cpp11_decltype_runme.py
+++ b/Examples/test-suite/python/cpp11_decltype_runme.py
@@ -3,16 +3,16 @@
 a = cpp11_decltype.A()
 a.i = 5
 if a.i != 5:
-    raise RuntimeError, "Assignment to a.i failed."
+    raise RuntimeError("Assignment to a.i failed.")
 
 a.j = 10
 if a.j != 10:
-    raise RuntimeError, "Assignment to a.j failed."
+    raise RuntimeError("Assignment to a.j failed.")
 
 b = a.foo(5)
 if b != 10:
-    raise RuntimeError, "foo(5) should return 10."
+    raise RuntimeError("foo(5) should return 10.")
 
 b = a.foo(6)
 if b != 0:
-    raise RuntimeError, "foo(6) should return 0."
+    raise RuntimeError("foo(6) should return 0.")
diff --git a/Examples/test-suite/python/cpp11_hash_tables_runme.py b/Examples/test-suite/python/cpp11_hash_tables_runme.py
index 7b772ff..3e7be49 100644
--- a/Examples/test-suite/python/cpp11_hash_tables_runme.py
+++ b/Examples/test-suite/python/cpp11_hash_tables_runme.py
@@ -10,14 +10,14 @@
 		  cpp11_hash_tables.UnorderedMultiMapIntInt({1:7})
          ]:
 
-	swig_assert_equal([(k, v) for k, v in x.iteritems()], [(1, 7)])
-	swig_assert_equal(x.keys(), [1])
-	swig_assert_equal(x.values(), [7])
-	swig_assert_equal(x.items(), [(1, 7)])
+	swig_assert_equal([(k, v) for k, v in x.items()], [(1, 7)])
+	swig_assert_equal(list(x.keys()), [1])
+	swig_assert_equal(list(x.values()), [7])
+	swig_assert_equal(list(x.items()), [(1, 7)])
 	swig_assert_equal([k for k in x], [1])
-	swig_assert_equal([i for i in x.iterkeys()], [1])
-	swig_assert_equal([i for i in x.itervalues()], [7])
-	swig_assert_equal([i for i in x.iteritems()], [(1, 7)])
+	swig_assert_equal([i for i in x.keys()], [1])
+	swig_assert_equal([i for i in x.values()], [7])
+	swig_assert_equal([i for i in x.items()], [(1, 7)])
 
 	swig_assert_equal(x[1], 7)
 	swig_assert_equal(2 in x, False)
@@ -33,7 +33,7 @@
 for x in [cpp11_hash_tables.MultiMapIntInt({1:7}),
 		  cpp11_hash_tables.UnorderedMultiMapIntInt({1:7})]:
 	x[1] = 9
-	swig_assert_equal(sorted([v for k, v in x.iteritems()]), [7, 9])
+	swig_assert_equal(sorted([v for k, v in x.items()]), [7, 9])
 	swig_assert_equal(len(x), 2)
 
 for x in [cpp11_hash_tables.SetInt([1]),
diff --git a/Examples/test-suite/python/cpp11_null_pointer_constant_runme.py b/Examples/test-suite/python/cpp11_null_pointer_constant_runme.py
index 54a8fe0..c397603 100644
--- a/Examples/test-suite/python/cpp11_null_pointer_constant_runme.py
+++ b/Examples/test-suite/python/cpp11_null_pointer_constant_runme.py
@@ -3,15 +3,15 @@
 a = cpp11_null_pointer_constant.A()
 
 if a._myA != None:
-    raise RuntimeError, (
+    raise RuntimeError(
         "cpp11_null_pointer_constant: _myA should be None, but is ", a._myA)
 
 b = cpp11_null_pointer_constant.A()
 if a._myA != b._myA:
-    raise RuntimeError, (
+    raise RuntimeError(
         "cpp11_null_pointer_constant: a._myA should be the same as b._myA, but ", a._myA, "!=", b._myA)
 
 a._myA = cpp11_null_pointer_constant.A()
 if a._myA == None:
-    raise RuntimeError, (
-        "cpp11_null_pointer_constant: _myA should be object, but is None")
+    raise RuntimeError((
+        "cpp11_null_pointer_constant: _myA should be object, but is None"))
diff --git a/Examples/test-suite/python/cpp11_raw_string_literals_runme.py b/Examples/test-suite/python/cpp11_raw_string_literals_runme.py
index 6a587b8..90e450f 100644
--- a/Examples/test-suite/python/cpp11_raw_string_literals_runme.py
+++ b/Examples/test-suite/python/cpp11_raw_string_literals_runme.py
@@ -34,19 +34,19 @@
     raise RuntimeError
 
 if cvar.bb != "UTF-8 string":
-    raise RuntimeError, cvar.wide
+    raise RuntimeError(cvar.wide)
 
 if cvar.xx != ")I'm an \"ascii\" \\ string.":
-    raise RuntimeError, cvar.xx
+    raise RuntimeError(cvar.xx)
 
 if cvar.ee != ")I'm an \"ascii\" \\ string.":
-    raise RuntimeError, cvar.ee
+    raise RuntimeError(cvar.ee)
 
 if cvar.ff != "I'm a \"raw wide\" \\ string.":
-    raise RuntimeError, cvar.ff
+    raise RuntimeError(cvar.ff)
 
 if cvar.gg != "I'm a \"raw UTF-8\" \\ string.":
-    raise RuntimeError, cvar.gg
+    raise RuntimeError(cvar.gg)
 
 
 def check(got, expected):
diff --git a/Examples/test-suite/python/cpp11_result_of_runme.py b/Examples/test-suite/python/cpp11_result_of_runme.py
index 4469efd..691d2a2 100644
--- a/Examples/test-suite/python/cpp11_result_of_runme.py
+++ b/Examples/test-suite/python/cpp11_result_of_runme.py
@@ -2,10 +2,10 @@
 
 result = cpp11_result_of.test_result(cpp11_result_of.SQUARE, 3.0)
 if result != 9.0:
-    raise RuntimeError, "test_result(square, 3.0) is not 9.0. Got: " + str(
-        result)
+    raise RuntimeError("test_result(square, 3.0) is not 9.0. Got: " + str(
+        result))
 
 result = cpp11_result_of.test_result_alternative1(cpp11_result_of.SQUARE, 3.0)
 if result != 9.0:
-    raise RuntimeError, "test_result_alternative1(square, 3.0) is not 9.0. Got: " + str(
-        result)
+    raise RuntimeError("test_result_alternative1(square, 3.0) is not 9.0. Got: " + str(
+        result))
diff --git a/Examples/test-suite/python/cpp11_rvalue_reference_runme.py b/Examples/test-suite/python/cpp11_rvalue_reference_runme.py
index c1cd3bf..85d64a5 100644
--- a/Examples/test-suite/python/cpp11_rvalue_reference_runme.py
+++ b/Examples/test-suite/python/cpp11_rvalue_reference_runme.py
@@ -4,24 +4,24 @@
 
 a.setAcopy(5)
 if a.getAcopy() != 5:
-    raise RunTimeError, ("int A::getAcopy() value is ",
+    raise RunTimeError("int A::getAcopy() value is ",
                          a.getAcopy(), " should be 5")
 
 ptr = a.getAptr()
 
 a.setAptr(ptr)
 if a.getAcopy() != 5:
-    raise RunTimeError, ("after A::setAptr(): int A::getAcopy() value is ", a.getAcopy(
+    raise RunTimeError("after A::setAptr(): int A::getAcopy() value is ", a.getAcopy(
     ), " should be 5")
 
 a.setAref(ptr)
 if a.getAcopy() != 5:
-    raise RunTimeError, ("after A::setAref(): int A::getAcopy() value is ", a.getAcopy(
+    raise RunTimeError("after A::setAref(): int A::getAcopy() value is ", a.getAcopy(
     ), " should be 5")
 
 rvalueref = a.getAmove()
 
 a.setAmove(rvalueref)
 if a.getAcopy() != 5:
-    raise RunTimeError, ("after A::setAmove(): int A::getAcopy() value is ", a.getAcopy(
+    raise RunTimeError("after A::setAmove(): int A::getAcopy() value is ", a.getAcopy(
     ), " should be 5")
diff --git a/Examples/test-suite/python/cpp11_std_array_runme.py b/Examples/test-suite/python/cpp11_std_array_runme.py
index e5e7373..9e11a3e 100644
--- a/Examples/test-suite/python/cpp11_std_array_runme.py
+++ b/Examples/test-suite/python/cpp11_std_array_runme.py
@@ -3,7 +3,7 @@
 
 
 def failed(a, b, msg):
-    raise RuntimeError, msg + " " + str(list(a)) + " " + str(list(b))
+    raise RuntimeError(msg + " " + str(list(a)) + " " + str(list(b)))
 
 
 def compare_sequences(a, b):
@@ -26,8 +26,8 @@
             a = swigarray[i::step]
         else:
             a = swigarray[i:j:step]
-        raise RuntimeError, "swigarray[" + str(i) + ":" + str(j) + ":" + str(step) + "] missed steps exception for " + str(list(swigarray))
-    except ValueError, e:
+        raise RuntimeError("swigarray[" + str(i) + ":" + str(j) + ":" + str(step) + "] missed steps exception for " + str(list(swigarray)))
+    except ValueError as e:
 #        print("exception: {}".format(e))
         pass
 
@@ -43,16 +43,16 @@
             del swigarray[i::step]
         else:
             del swigarray[i:j:step]
-        raise RuntimeError, "swigarray[" + str(i) + ":" + str(j) + ":" + str(step) + "] missed del exception for " + str(list(swigarray))
-    except ValueError, e:
+        raise RuntimeError("swigarray[" + str(i) + ":" + str(j) + ":" + str(step) + "] missed del exception for " + str(list(swigarray)))
+    except ValueError as e:
 #        print("exception: {}".format(e))
         pass
 
 def setslice_exception(swigarray, newval):
     try:
         swigarray[::] = newval
-        raise RuntimeError, "swigarray[::] = " + str(newval) + " missed set exception for swigarray:" + str(list(swigarray))
-    except TypeError, e:
+        raise RuntimeError("swigarray[::] = " + str(newval) + " missed set exception for swigarray:" + str(list(swigarray)))
+    except TypeError as e:
 #        print("exception: {}".format(e))
         pass
 
diff --git a/Examples/test-suite/python/cpp11_uniform_initialization_runme.py b/Examples/test-suite/python/cpp11_uniform_initialization_runme.py
index ecb468c..b01557a 100644
--- a/Examples/test-suite/python/cpp11_uniform_initialization_runme.py
+++ b/Examples/test-suite/python/cpp11_uniform_initialization_runme.py
@@ -9,13 +9,13 @@
 
 m = cpp11_uniform_initialization.MoreInit()
 if m.charptr != None:
-    raise RuntimeError, m.charptr
+    raise RuntimeError(m.charptr)
 m.charptr = "hello sir"
 if m.charptr != "hello sir":
-    raise RuntimeError, m.charptr
+    raise RuntimeError(m.charptr)
 if m.more1(m.vi) != 15:
-    raise RuntimeError, m.vi
+    raise RuntimeError(m.vi)
 if m.more1([-1, 1, 2]) != 2:
-    raise RuntimeError, m.vi
+    raise RuntimeError(m.vi)
 if m.more1() != 10:
     raise RuntimeError
diff --git a/Examples/test-suite/python/cpp_enum_runme.py b/Examples/test-suite/python/cpp_enum_runme.py
index 5f1e91c..910d378 100644
--- a/Examples/test-suite/python/cpp_enum_runme.py
+++ b/Examples/test-suite/python/cpp_enum_runme.py
@@ -3,21 +3,17 @@
 f = cpp_enum.Foo()
 
 if f.hola != f.Hello:
-    print f.hola
-    raise RuntimeError
+    raise RuntimeError("f.hola: {}".format(f.hola))
 
 f.hola = f.Hi
 if f.hola != f.Hi:
-    print f.hola
-    raise RuntimeError
+    raise RuntimeError("f.hola: {}".format(f.hola))
 
 f.hola = f.Hello
 
 if f.hola != f.Hello:
-    print f.hola
-    raise RuntimeError
+    raise RuntimeError("f.hola: {}".format(f.hola))
 
 cpp_enum.cvar.hi = cpp_enum.Hello
 if cpp_enum.cvar.hi != cpp_enum.Hello:
-    print cpp_enum.cvar.hi
-    raise RuntimeError
+    raise RuntimeError("cpp_enum.cvar.hi: {}".format(cpp_enum.cvar.hi))
diff --git a/Examples/test-suite/python/default_args_runme.py b/Examples/test-suite/python/default_args_runme.py
index 14ef8c5..0ce47ab 100644
--- a/Examples/test-suite/python/default_args_runme.py
+++ b/Examples/test-suite/python/default_args_runme.py
@@ -108,48 +108,34 @@
     if Klass_inc().val != 0:
         raise RuntimeError("Klass::inc failed")
 
-    tricky_failure = False
     tricky = default_args.TrickyInPython()
     if tricky.value_m1(10) != -1:
-        print "trickyvalue_m1 failed"
-        tricky_failure = True
+        raise RuntimeError("trickyvalue_m1 failed")
     if tricky.value_m1(10, 10) != 10:
-        print "trickyvalue_m1 failed"
-        tricky_failure = True
+        raise RuntimeError("trickyvalue_m1 failed")
     if tricky.value_0xabcdef(10) != 0xabcdef:
-        print "trickyvalue_0xabcdef failed"
-        tricky_failure = True
+        raise RuntimeError("trickyvalue_0xabcdef failed")
     if tricky.value_0644(10) != 420:
-        print "trickyvalue_0644 failed"
-        tricky_failure = True
+        raise RuntimeError("trickyvalue_0644 failed")
     if tricky.value_perm(10) != 420:
-        print "trickyvalue_perm failed"
-        tricky_failure = True
+        raise RuntimeError("trickyvalue_perm failed")
     if tricky.value_m01(10) != -1:
-        print "trickyvalue_m01 failed"
-        tricky_failure = True
+        raise RuntimeError("trickyvalue_m01 failed")
     if not tricky.booltest2():
-        print "booltest2 failed"
-        tricky_failure = True
+        raise RuntimeError("booltest2 failed")
 
     if tricky.max_32bit_int1() != 0x7FFFFFFF:
-        print "max_32bit_int1 failed"
-        tricky_failure = True
+        raise RuntimeError("max_32bit_int1 failed")
     if tricky.min_32bit_int1() != -2147483648:
-        print "min_32bit_int1 failed"
-        tricky_failure = True
+        raise RuntimeError("min_32bit_int1 failed")
     if tricky.max_32bit_int2() != 0x7FFFFFFF:
-        print "max_32bit_int2 failed"
-        tricky_failure = True
+        raise RuntimeError("max_32bit_int2 failed")
 
     tricky.too_big_32bit_int1()
     tricky.too_small_32bit_int1()
     tricky.too_big_32bit_int2()
     tricky.too_small_32bit_int2()
 
-    if tricky_failure:
-        raise RuntimeError
-
     default_args.seek()
     default_args.seek(10)
 
diff --git a/Examples/test-suite/python/default_constructor_runme.py b/Examples/test-suite/python/default_constructor_runme.py
index 1e877ad..2943dc9 100644
--- a/Examples/test-suite/python/default_constructor_runme.py
+++ b/Examples/test-suite/python/default_constructor_runme.py
@@ -16,24 +16,24 @@
 
 try:
     b = dc.new_B()
-    print "Whoa. new_BB created."
-except:
+    raise RuntimeError("Whoa. new_BB created.")
+except TypeError:
     pass
 
 del_b = dc.delete_B
 
 try:
     bb = dc.new_BB()
-    print "Whoa. new_BB created."
-except:
+    raise RuntimeError("Whoa. new_BB created.")
+except AttributeError:
     pass
 
 del_bb = dc.delete_BB
 
 try:
     c = dc.new_C()
-    print "Whoa. new_C created."
-except:
+    raise RuntimeError("Whoa. new_C created.")
+except AttributeError:
     pass
 
 del_c = dc.delete_C
@@ -43,24 +43,24 @@
 
 try:
     d = dc.new_D()
-    print "Whoa. new_D created"
-except:
+    raise RuntimeError("Whoa. new_D created")
+except AttributeError:
     pass
 
 del_d = dc.delete_D
 
 try:
     dd = dc.new_DD()
-    print "Whoa. new_DD created"
-except:
+    raise RuntimeError("Whoa. new_DD created")
+except AttributeError:
     pass
 
 dd = dc.delete_DD
 
 try:
     ad = dc.new_AD()
-    print "Whoa. new_AD created"
-except:
+    raise RuntimeError("Whoa. new_AD created")
+except AttributeError:
     pass
 
 del_ad = dc.delete_AD
@@ -73,8 +73,8 @@
 
 try:
     eb = dc.new_EB()
-    print "Whoa. new_EB created"
-except:
+    raise RuntimeError("Whoa. new_EB created")
+except AttributeError:
     pass
 
 del_eb = dc.delete_EB
@@ -83,7 +83,7 @@
 
 try:
     del_f = dc.delete_F
-    print "Whoa. delete_F created"
+    raise RuntimeError("Whoa. delete_F created")
 except AttributeError:
     pass
 
@@ -93,7 +93,7 @@
 
 try:
     del_g = dc.delete_G
-    print "Whoa. delete_G created"
+    raise RuntimeError("Whoa. delete_G created")
 except AttributeError:
     pass
 
diff --git a/Examples/test-suite/python/director_abstract_runme.py b/Examples/test-suite/python/director_abstract_runme.py
index 333b75f..c8c4b36 100644
--- a/Examples/test-suite/python/director_abstract_runme.py
+++ b/Examples/test-suite/python/director_abstract_runme.py
@@ -13,10 +13,10 @@
 a = MyFoo()
 
 if a.ping() != "MyFoo::ping()":
-    raise RuntimeError, a.ping()
+    raise RuntimeError(a.ping())
 
 if a.pong() != "Foo::pong();MyFoo::ping()":
-    raise RuntimeError, a.pong()
+    raise RuntimeError(a.pong())
 
 
 class MyExample1(director_abstract.Example1):
diff --git a/Examples/test-suite/python/director_alternating_runme.py b/Examples/test-suite/python/director_alternating_runme.py
index a93ffec..dc85351 100644
--- a/Examples/test-suite/python/director_alternating_runme.py
+++ b/Examples/test-suite/python/director_alternating_runme.py
@@ -2,4 +2,4 @@
 
 id = getBar().id()
 if id != idFromGetBar():
-    raise RuntimeError, "Got wrong id: " + str(id)
+    raise RuntimeError("Got wrong id: " + str(id))
diff --git a/Examples/test-suite/python/director_basic_runme.py b/Examples/test-suite/python/director_basic_runme.py
index 6564c95..79cd0e2 100644
--- a/Examples/test-suite/python/director_basic_runme.py
+++ b/Examples/test-suite/python/director_basic_runme.py
@@ -10,18 +10,18 @@
 a = PyFoo()
 
 if a.ping() != "PyFoo::ping()":
-    raise RuntimeError, a.ping()
+    raise RuntimeError(a.ping())
 
 if a.pong() != "Foo::pong();PyFoo::ping()":
-    raise RuntimeError, a.pong()
+    raise RuntimeError(a.pong())
 
 b = director_basic.Foo()
 
 if b.ping() != "Foo::ping()":
-    raise RuntimeError, b.ping()
+    raise RuntimeError(b.ping())
 
 if b.pong() != "Foo::pong();Foo::ping()":
-    raise RuntimeError, b.pong()
+    raise RuntimeError(b.pong())
 
 a = director_basic.A1(1)
 
diff --git a/Examples/test-suite/python/director_comparison_operators_runme.py b/Examples/test-suite/python/director_comparison_operators_runme.py
index 4fe7330..e9bf943 100644
--- a/Examples/test-suite/python/director_comparison_operators_runme.py
+++ b/Examples/test-suite/python/director_comparison_operators_runme.py
@@ -8,4 +8,4 @@
 a = PyFoo()
 
 if a.test() != "a=1,b=2":
-    raise RuntimeError, a.test()
+    raise RuntimeError(a.test())
diff --git a/Examples/test-suite/python/director_detect_runme.py b/Examples/test-suite/python/director_detect_runme.py
index 3450519..b9c73eb 100644
--- a/Examples/test-suite/python/director_detect_runme.py
+++ b/Examples/test-suite/python/director_detect_runme.py
@@ -35,4 +35,4 @@
 vc = c.get_value()
 
 if (v != 3) or (b.val != 5) or (vc != 6):
-    raise RuntimeError, "Bad virtual detection"
+    raise RuntimeError("Bad virtual detection")
diff --git a/Examples/test-suite/python/director_exception_runme.py b/Examples/test-suite/python/director_exception_runme.py
index 06856f3..458983c 100644
--- a/Examples/test-suite/python/director_exception_runme.py
+++ b/Examples/test-suite/python/director_exception_runme.py
@@ -10,7 +10,7 @@
 class MyFoo(Foo):
 
     def ping(self):
-        raise NotImplementedError, "MyFoo::ping() EXCEPTION"
+        raise NotImplementedError("MyFoo::ping() EXCEPTION")
 
 
 class MyFoo2(Foo):
@@ -28,74 +28,58 @@
 class MyFoo4(Foo):
 
     def ping(self, *args):
-        print(type("bad", "call")) # throws TypeError message: type() takes 1 or 3 arguments
+        t = type("bad", "call") # throws TypeError message: type() takes 1 or 3 arguments
         return "Foo4.ping"
 
 
 # Check that the NotImplementedError raised by MyFoo.ping() is returned by
 # MyFoo.pong().
-ok = 0
 a = MyFoo()
 b = launder(a)
 try:
     b.pong()
-except NotImplementedError, e:
-    if str(e) == "MyFoo::ping() EXCEPTION":
-        ok = 1
-    else:
-        print "Unexpected error message: %s" % str(e)
-except:
+    raise RuntimeError("Exception was not thrown")
+except NotImplementedError as e:
+    if not str(e) == "MyFoo::ping() EXCEPTION":
+        raise RuntimeError("Unexpected error message: %s" % str(e))
+except TypeError:
     pass
-if not ok:
-    raise RuntimeError
 
 
 # Check that the director returns the appropriate TypeError if the return type
 # is wrong.
-ok = 0
 a = MyFoo2()
 b = launder(a)
 try:
     b.pong()
-except TypeError, e:
+    raise RuntimeError("Exception was not thrown")
+except TypeError as e:
     # fastdispatch mode adds on Additional Information to the exception message - just check the main exception message exists
-    if str(e).startswith("SWIG director type mismatch in output value of type 'std::string'"):
-        ok = 1
-    else:
-        print "Unexpected error message: %s" % str(e)
-if not ok:
-    raise RuntimeError
+    if not str(e).startswith("SWIG director type mismatch in output value of type 'std::string'"):
+        raise RuntimeError("Unexpected error message: %s" % str(e))
 
 
 # Check that the director can return an exception which requires two arguments
 # to the constructor, without mangling it.
-ok = 0
 a = MyFoo3()
 b = launder(a)
 try:
     b.pong()
-except MyException, e:
-    if e.msg == "foobar":
-        ok = 1
-    else:
-        print "Unexpected error message: %s" % str(e)
-if not ok:
-    raise RuntimeError
+    raise RuntimeError("Exception was not thrown")
+except MyException as e:
+    if e.msg != "foobar":
+        raise RuntimeError("Unexpected error message: %s" % str(e))
 
 
 # Check that the director returns the appropriate TypeError thrown in a director method
-ok = 0
 a = MyFoo4()
 b = launder(a)
 try:
     b.pong()
+    raise RuntimeError("Exception was not thrown")
 except TypeError as e:
-    if str(e).startswith("type() takes 1 or 3 arguments"):
-        ok = 1
-    else:
-        print "Unexpected error message: %s" % str(e)
-if not ok:
-    raise RuntimeError
+    if not str(e).startswith("type() takes 1 or 3 arguments"):
+        raise RuntimeError("Unexpected error message: %s" % str(e))
 
 
 # This is expected to fail with -builtin option
diff --git a/Examples/test-suite/python/director_extend_runme.py b/Examples/test-suite/python/director_extend_runme.py
index a5aad82..870443d 100644
--- a/Examples/test-suite/python/director_extend_runme.py
+++ b/Examples/test-suite/python/director_extend_runme.py
@@ -17,6 +17,6 @@
 
 m = MyObject()
 if m.dummy() != 666:
-    raise RuntimeError, "1st call"
+    raise RuntimeError("1st call")
 if m.dummy() != 666:                        # Locked system
-    raise RuntimeError, "2nd call"
+    raise RuntimeError("2nd call")
diff --git a/Examples/test-suite/python/director_frob_runme.py b/Examples/test-suite/python/director_frob_runme.py
index 0ef4ad9..6c8fcad 100644
--- a/Examples/test-suite/python/director_frob_runme.py
+++ b/Examples/test-suite/python/director_frob_runme.py
@@ -4,4 +4,4 @@
 s = foo.abs_method()
 
 if s != "Bravo::abs_method()":
-    raise RuntimeError, s
+    raise RuntimeError(s)
diff --git a/Examples/test-suite/python/director_nested_runme.py b/Examples/test-suite/python/director_nested_runme.py
index f3d9736..b2c4b0d 100644
--- a/Examples/test-suite/python/director_nested_runme.py
+++ b/Examples/test-suite/python/director_nested_runme.py
@@ -14,7 +14,7 @@
 
 a = A()
 if a.step() != "Bar::step;Foo::advance;Bar::do_advance;A::do_step;":
-    raise RuntimeError, "Bad A virtual resolution"
+    raise RuntimeError("Bad A virtual resolution")
 
 
 class B(FooBar_int):
@@ -34,7 +34,7 @@
 b = B()
 
 if b.step() != "Bar::step;Foo::advance;B::do_advance;B::do_step;":
-    raise RuntimeError, "Bad B virtual resolution"
+    raise RuntimeError("Bad B virtual resolution")
 
 
 class C(FooBar_int):
diff --git a/Examples/test-suite/python/director_profile_runme.py b/Examples/test-suite/python/director_profile_runme.py
index 035007c..7c269c3 100644
--- a/Examples/test-suite/python/director_profile_runme.py
+++ b/Examples/test-suite/python/director_profile_runme.py
@@ -38,4 +38,4 @@
     a = fi(a)  # 20
     i -= 1
 
-print a
+print("a: {}".format(a))
diff --git a/Examples/test-suite/python/director_protected_runme.py b/Examples/test-suite/python/director_protected_runme.py
index c3118a7..94eab69 100644
--- a/Examples/test-suite/python/director_protected_runme.py
+++ b/Examples/test-suite/python/director_protected_runme.py
@@ -35,7 +35,7 @@
         raise RuntimeError
     pass
 except:
-    raise RuntimeError, "bad FooBar::used"
+    raise RuntimeError("bad FooBar::used")
 
 try:
     s = fb2.used()
@@ -43,7 +43,7 @@
         raise RuntimeError
     pass
 except:
-    raise RuntimeError, "bad FooBar2::used"
+    raise RuntimeError("bad FooBar2::used")
 
 try:
     s = b.pong()
@@ -51,7 +51,7 @@
         raise RuntimeError
     pass
 except:
-    raise RuntimeError, "bad Bar::pong"
+    raise RuntimeError("bad Bar::pong")
 
 try:
     s = f.pong()
@@ -59,7 +59,7 @@
         raise RuntimeError
     pass
 except:
-    raise RuntimeError, " bad Foo::pong"
+    raise RuntimeError(" bad Foo::pong")
 
 try:
     s = fb.pong()
@@ -67,7 +67,7 @@
         raise RuntimeError
     pass
 except:
-    raise RuntimeError, " bad FooBar::pong"
+    raise RuntimeError(" bad FooBar::pong")
 
 protected = 1
 try:
@@ -76,7 +76,7 @@
 except:
     pass
 if not protected:
-    raise RuntimeError, "Foo::ping is protected"
+    raise RuntimeError("Foo::ping is protected")
 
 protected = 1
 try:
@@ -85,7 +85,7 @@
 except:
     pass
 if not protected:
-    raise RuntimeError, "Foo::ping is protected"
+    raise RuntimeError("Foo::ping is protected")
 
 
 protected = 1
@@ -95,7 +95,7 @@
 except:
     pass
 if not protected:
-    raise RuntimeError, "FooBar::pang is protected"
+    raise RuntimeError("FooBar::pang is protected")
 
 
 protected = 1
@@ -105,7 +105,7 @@
 except:
     pass
 if not protected:
-    raise RuntimeError, "Bar::cheer is protected"
+    raise RuntimeError("Bar::cheer is protected")
 
 protected = 1
 try:
@@ -114,19 +114,19 @@
 except:
     pass
 if not protected:
-    raise RuntimeError, "Foo::cheer is protected"
+    raise RuntimeError("Foo::cheer is protected")
 
 if fb3.cheer() != "FooBar3::cheer();":
-    raise RuntimeError, "bad fb3::cheer"
+    raise RuntimeError("bad fb3::cheer")
 
 if fb2.callping() != "FooBar2::ping();":
-    raise RuntimeError, "bad fb2.callping"
+    raise RuntimeError("bad fb2.callping")
 
 if fb2.callcheer() != "FooBar2::pang();Bar::pong();Foo::pong();FooBar2::ping();":
-    raise RuntimeError, "bad fb2.callcheer"
+    raise RuntimeError("bad fb2.callcheer")
 
 if fb3.callping() != "Bar::ping();":
-    raise RuntimeError, "bad fb3.callping"
+    raise RuntimeError("bad fb3.callping")
 
 if fb3.callcheer() != "FooBar3::cheer();":
-    raise RuntimeError, "bad fb3.callcheer"
+    raise RuntimeError("bad fb3.callcheer")
diff --git a/Examples/test-suite/python/director_smartptr_runme.py b/Examples/test-suite/python/director_smartptr_runme.py
index 23e22d0..b4cbafe 100644
--- a/Examples/test-suite/python/director_smartptr_runme.py
+++ b/Examples/test-suite/python/director_smartptr_runme.py
@@ -31,7 +31,7 @@
 
 def check(got, expected):
   if (got != expected):
-    raise RuntimeError, "Failed, got: " + got + " expected: " + expected
+    raise RuntimeError("Failed, got: " + got + " expected: " + expected)
 
 fooBar = FooBar()
 
diff --git a/Examples/test-suite/python/director_string_runme.py b/Examples/test-suite/python/director_string_runme.py
index dcd47d6..c6d4c81 100644
--- a/Examples/test-suite/python/director_string_runme.py
+++ b/Examples/test-suite/python/director_string_runme.py
@@ -18,12 +18,10 @@
 
 b.get(0)
 if b.get_first() != "hello world!":
-    print b.get_first()
-    raise RuntimeError
+    raise RuntimeError("b.get_first(): {}".format(b.get_first()))
 
 
 b.call_process_func()
 
 if b.smem != "hello":
-    print smem
-    raise RuntimeError
+    raise RuntimeError("smem: {}".format(smem))
diff --git a/Examples/test-suite/python/director_thread_runme.py b/Examples/test-suite/python/director_thread_runme.py
index 4fcf3bf..21a8ce1 100644
--- a/Examples/test-suite/python/director_thread_runme.py
+++ b/Examples/test-suite/python/director_thread_runme.py
@@ -14,7 +14,6 @@
 d.run()
 
 if d.val >= 0:
-    print d.val
-    raise RuntimeError
+    raise RuntimeError("d.val: {}".format(d.val))
 
 d.stop()
diff --git a/Examples/test-suite/python/director_unroll_runme.py b/Examples/test-suite/python/director_unroll_runme.py
index 60bc055..ea602d8 100644
--- a/Examples/test-suite/python/director_unroll_runme.py
+++ b/Examples/test-suite/python/director_unroll_runme.py
@@ -16,5 +16,4 @@
 
 
 if not (a.this == c.this):
-    print a, c
-    raise RuntimeError
+    raise RuntimeError("{} {}".format(a, c))
diff --git a/Examples/test-suite/python/director_wstring_runme.py b/Examples/test-suite/python/director_wstring_runme.py
index b7929c0..5facc1f 100644
--- a/Examples/test-suite/python/director_wstring_runme.py
+++ b/Examples/test-suite/python/director_wstring_runme.py
@@ -7,22 +7,20 @@
         A.__init__(self, string)
 
     def get_first(self):
-        return A.get_first(self) + u" world!"
+        return A.get_first(self) + " world!"
 
     def process_text(self, s):
         self.smem = s
 
 
-b = B(u"hello")
+b = B("hello")
 
 b.get(0)
-if b.get_first() != u"hello world!":
-    print b.get_first()
-    raise RuntimeError
+if b.get_first() != "hello world!":
+    raise RuntimeError("b.get_first(): {}".format(b.get_first()))
 
 
 b.call_process_func()
 
-if b.smem != u"hello":
-    print smem
-    raise RuntimeError
+if b.smem != "hello":
+    raise RuntimeError("smem: {}".format(smem))
diff --git a/Examples/test-suite/python/dynamic_cast_runme.py b/Examples/test-suite/python/dynamic_cast_runme.py
index 59e86d3..ae08083 100644
--- a/Examples/test-suite/python/dynamic_cast_runme.py
+++ b/Examples/test-suite/python/dynamic_cast_runme.py
@@ -8,4 +8,4 @@
 
 a = dynamic_cast.do_test(y)
 if a != "Bar::test":
-    print "Failed!!"
+    raise RuntimeError("Failed!!")
diff --git a/Examples/test-suite/python/exception_order_runme.py b/Examples/test-suite/python/exception_order_runme.py
index c53521e..5c15299 100644
--- a/Examples/test-suite/python/exception_order_runme.py
+++ b/Examples/test-suite/python/exception_order_runme.py
@@ -9,36 +9,35 @@
 
 try:
     a.foo()
-except E1, e:
+except E1 as e:
     pass
 except:
-    raise RuntimeError, "bad exception order"
+    raise RuntimeError("bad exception order")
 
 try:
     a.bar()
-except E2, e:
+except E2 as e:
     pass
 except:
-    raise RuntimeError, "bad exception order"
+    raise RuntimeError("bad exception order")
 
 try:
     a.foobar()
-except RuntimeError, e:
+except RuntimeError as e:
     if e.args[0] != "postcatch unknown":
-        print "bad exception order",
-        raise RuntimeError, e.args
+        raise RuntimeError("bad exception order {}".format(e.args))
 
 
 try:
     a.barfoo(1)
-except E1, e:
+except E1 as e:
     pass
 except:
-    raise RuntimeError, "bad exception order"
+    raise RuntimeError("bad exception order")
 
 try:
     a.barfoo(2)
-except E2, e:
+except E2 as e:
     pass
 except:
-    raise RuntimeError, "bad exception order"
+    raise RuntimeError("bad exception order")
diff --git a/Examples/test-suite/python/fvirtual_runme.py b/Examples/test-suite/python/fvirtual_runme.py
index 99f5dc6..fe211b4 100644
--- a/Examples/test-suite/python/fvirtual_runme.py
+++ b/Examples/test-suite/python/fvirtual_runme.py
@@ -5,4 +5,4 @@
 i = sw.addChild(n)
 
 if i != 2:
-    raise RuntimeError, "addChild"
+    raise RuntimeError("addChild")
diff --git a/Examples/test-suite/python/global_functions_runme.py b/Examples/test-suite/python/global_functions_runme.py
index f411261..4aab1b0 100644
--- a/Examples/test-suite/python/global_functions_runme.py
+++ b/Examples/test-suite/python/global_functions_runme.py
@@ -11,7 +11,7 @@
 fail = True
 try:
     global_void(1)
-except TypeError, e:
+except TypeError as e:
     fail = False
 if fail:
     raise RuntimeError("argument count check failed")
@@ -19,7 +19,7 @@
 fail = True
 try:
     global_one()
-except TypeError, e:
+except TypeError as e:
     fail = False
 if fail:
     raise RuntimeError("argument count check failed")
@@ -27,7 +27,7 @@
 fail = True
 try:
     global_one(2, 2)
-except TypeError, e:
+except TypeError as e:
     fail = False
 
 if fail:
@@ -36,7 +36,7 @@
 fail = True
 try:
     global_two(1)
-except TypeError, e:
+except TypeError as e:
     fail = False
 
 if fail:
@@ -45,7 +45,7 @@
 fail = True
 try:
     global_two(3, 3, 3)
-except TypeError, e:
+except TypeError as e:
     fail = False
 
 if fail:
diff --git a/Examples/test-suite/python/global_vars_runme.py b/Examples/test-suite/python/global_vars_runme.py
index 3ef0b49..015519e 100644
--- a/Examples/test-suite/python/global_vars_runme.py
+++ b/Examples/test-suite/python/global_vars_runme.py
@@ -20,7 +20,7 @@
 fail = True
 try:
     global_vars.cvar.notexist = "something"
-except AttributeError, e:
+except AttributeError as e:
     fail = False
 if fail:
     raise RuntimeError("AttributeError should have been thrown")
@@ -28,7 +28,7 @@
 fail = True
 try:
     g = global_vars.cvar.notexist
-except AttributeError, e:
+except AttributeError as e:
     fail = False
 if fail:
     raise RuntimeError("AttributeError should have been thrown")
diff --git a/Examples/test-suite/python/import_stl_runme.py b/Examples/test-suite/python/import_stl_runme.py
index 69fe812..d0efbd0 100644
--- a/Examples/test-suite/python/import_stl_runme.py
+++ b/Examples/test-suite/python/import_stl_runme.py
@@ -3,4 +3,4 @@
 
 v_new = import_stl_b.process_vector([1, 2, 3])
 if v_new != (1, 2, 3, 4):
-    raise RuntimeError, v_new
+    raise RuntimeError(v_new)
diff --git a/Examples/test-suite/python/inctest_runme.py b/Examples/test-suite/python/inctest_runme.py
index fa34929..c274656 100644
--- a/Examples/test-suite/python/inctest_runme.py
+++ b/Examples/test-suite/python/inctest_runme.py
@@ -1,31 +1,21 @@
 import inctest
 
-error = 0
 try:
     a = inctest.A()
 except:
-    print "didn't find A"
-    print "therefore, I didn't include 'testdir/subdir1/hello.i'"
-    error = 1
+    raise RuntimeError("didn't find A, therefore, I didn't include 'testdir/subdir1/hello.i'")
 pass
 
 
 try:
     b = inctest.B()
 except:
-    print "didn't find B"
-    print "therefore, I didn't include 'testdir/subdir2/hello.i'"
-    error = 1
+    raise RuntimeError("didn't find B, therefore, I didn't include 'testdir/subdir2/hello.i'")
 pass
 
-if error == 1:
-    raise RuntimeError
-
 # Check the import in subdirectory worked
 if inctest.importtest1(5) != 15:
-    print "import test 1 failed"
-    raise RuntimeError
+    raise RuntimeError("import test 1 failed")
 
 if inctest.importtest2("black") != "white":
-    print "import test 2 failed"
-    raise RuntimeError
+    raise RuntimeError("import test 2 failed")
diff --git a/Examples/test-suite/python/inherit_missing_runme.py b/Examples/test-suite/python/inherit_missing_runme.py
index 044c166..57a245e 100644
--- a/Examples/test-suite/python/inherit_missing_runme.py
+++ b/Examples/test-suite/python/inherit_missing_runme.py
@@ -6,14 +6,14 @@
 
 x = inherit_missing.do_blah(a)
 if x != "Foo::blah":
-    print "Whoa! Bad return", x
+    raise RuntimeError("Whoa! Bad return {}".format(x))
 
 x = inherit_missing.do_blah(b)
 if x != "Bar::blah":
-    print "Whoa! Bad return", x
+    raise RuntimeError("Whoa! Bad return {}".format(x))
 
 x = inherit_missing.do_blah(c)
 if x != "Spam::blah":
-    print "Whoa! Bad return", x
+    raise RuntimeError("Whoa! Bad return {}".format(x))
 
 inherit_missing.delete_Foo(a)
diff --git a/Examples/test-suite/python/inplaceadd_runme.py b/Examples/test-suite/python/inplaceadd_runme.py
index 7f292cb..3d5a1fd 100644
--- a/Examples/test-suite/python/inplaceadd_runme.py
+++ b/Examples/test-suite/python/inplaceadd_runme.py
@@ -3,8 +3,7 @@
 
 a += 5
 if a.val != 12:
-    print a.val
-    raise RuntimeError
+    raise RuntimeError("a.val: {}".format(a.val))
 
 a -= 5
 if a.val != 7:
diff --git a/Examples/test-suite/python/li_attribute_runme.py b/Examples/test-suite/python/li_attribute_runme.py
index 80e7936..a5a6914 100644
--- a/Examples/test-suite/python/li_attribute_runme.py
+++ b/Examples/test-suite/python/li_attribute_runme.py
@@ -8,12 +8,10 @@
     raise RuntimeError
 aa.a = 3
 if aa.a != 3:
-    print aa.a
-    raise RuntimeError
+    raise RuntimeError("aa.a: {}".format(aa.a))
 
 if aa.b != 2:
-    print aa.b
-    raise RuntimeError
+    raise RuntimeError("aa.b: {}".format(aa.b))
 aa.b = 5
 if aa.b != 5:
     raise RuntimeError
@@ -77,7 +75,7 @@
 try:
     x = myFoo.does_not_exist
     raise RuntimeError
-except AttributeError, e:
+except AttributeError as e:
     if str(e).find("does_not_exist") == -1:
         raise RuntimeError
 
diff --git a/Examples/test-suite/python/li_attribute_template_runme.py b/Examples/test-suite/python/li_attribute_template_runme.py
index d33b123..f0a7749 100644
--- a/Examples/test-suite/python/li_attribute_template_runme.py
+++ b/Examples/test-suite/python/li_attribute_template_runme.py
@@ -7,8 +7,7 @@
 
 def rassert(what, master):
     if what != master:
-        print what
-        raise RuntimeError
+        raise RuntimeError("what: {}".format(what))
 
 # Testing primitive by value attribute
 rassert(chell.a, 1)
diff --git a/Examples/test-suite/python/li_boost_shared_ptr_runme.py b/Examples/test-suite/python/li_boost_shared_ptr_runme.py
index c960625..ecda7fd 100644
--- a/Examples/test-suite/python/li_boost_shared_ptr_runme.py
+++ b/Examples/test-suite/python/li_boost_shared_ptr_runme.py
@@ -10,7 +10,7 @@
 
     def main(self):
         if (debug):
-            print "Started"
+            print("Started")
 
         li_boost_shared_ptr.cvar.debug_shared = debug
 
@@ -32,7 +32,7 @@
                     "shared_ptr wrapper count=%s" % wrapper_count)
 
         if (debug):
-            print "Finished"
+            print("Finished")
 
     def runtest(self):
         # simple shared_ptr usage - created in C++
diff --git a/Examples/test-suite/python/li_cstring_runme.py b/Examples/test-suite/python/li_cstring_runme.py
index b718f13..d22fc26 100644
--- a/Examples/test-suite/python/li_cstring_runme.py
+++ b/Examples/test-suite/python/li_cstring_runme.py
@@ -11,12 +11,10 @@
     raise RuntimeError
 
 if test3("hello") != "hello-suffix":
-    print test3("hello")
-    raise RuntimeError
+    raise RuntimeError("test3(\"hello\")")
 
 if test4("hello") != "hello-suffix":
-    print test4("hello")
-    raise RuntimeError
+    raise RuntimeError("test4(\"hello\")")
 
 if test5(4) != "xxxx":
     raise RuntimeError
diff --git a/Examples/test-suite/python/li_cwstring_runme.py b/Examples/test-suite/python/li_cwstring_runme.py
index 5dd7b9b..9216445 100644
--- a/Examples/test-suite/python/li_cwstring_runme.py
+++ b/Examples/test-suite/python/li_cwstring_runme.py
@@ -1,28 +1,28 @@
 from li_cwstring import *
 
-if count(u"ab\0ab\0ab\0", 0) != 3:
+if count("ab\0ab\0ab\0", 0) != 3:
     raise RuntimeError
 
-if test1() != u"Hello World":
+if test1() != "Hello World":
     raise RuntimeError
 
-if test2() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_":
+if test2() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_":
     raise RuntimeError
 
-if test3("hello") != u"hello-suffix":
+if test3("hello") != "hello-suffix":
     raise RuntimeError
 
-if test4("hello") != u"hello-suffix":
+if test4("hello") != "hello-suffix":
     raise RuntimeError
 
-if test5(4) != u"xxxx":
+if test5(4) != "xxxx":
     raise RuntimeError
 
-if test6(10) != u"xxxxx":
+if test6(10) != "xxxxx":
     raise RuntimeError
 
-if test7() != u"Hello world!":
+if test7() != "Hello world!":
     raise RuntimeError
 
-if test8() != u" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_":
+if test8() != " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_":
     raise RuntimeError
diff --git a/Examples/test-suite/python/li_implicit_runme.py b/Examples/test-suite/python/li_implicit_runme.py
index d8dd0fd..5d5c6ca 100644
--- a/Examples/test-suite/python/li_implicit_runme.py
+++ b/Examples/test-suite/python/li_implicit_runme.py
@@ -9,8 +9,8 @@
 ab, get(ab)
 
 if get(ai) != get(1):
-    raise RuntimeError, "bad implicit type"
+    raise RuntimeError("bad implicit type")
 if get(ad) != get(2.0):
-    raise RuntimeError, "bad implicit type"
+    raise RuntimeError("bad implicit type")
 if get(ab) != get(b):
-    raise RuntimeError, "bad implicit type"
+    raise RuntimeError("bad implicit type")
diff --git a/Examples/test-suite/python/li_std_containers_int_runme.py b/Examples/test-suite/python/li_std_containers_int_runme.py
index 941838a..f346de2 100644
--- a/Examples/test-suite/python/li_std_containers_int_runme.py
+++ b/Examples/test-suite/python/li_std_containers_int_runme.py
@@ -6,7 +6,7 @@
 
 
 def failed(a, b, msg):
-    raise RuntimeError, msg + " " + str(list(a)) + " " + str(list(b))
+    raise RuntimeError(msg + " " + str(list(a)) + " " + str(list(b)))
 
 
 def compare_sequences(a, b):
@@ -26,7 +26,7 @@
 
 
 def container_insert_step(i, j, step, newval):
-    ps = range(6)
+    ps = list(range(6))
     iv = vector_int(ps)
     il = list_int(ps)
 
@@ -43,9 +43,9 @@
             else:
                 ps[i:j:step] = newval
         ps_error = None
-    except ValueError, e:
+    except ValueError as e:
         ps_error = e
-    except IndexError, e:
+    except IndexError as e:
         ps_error = e
 
     # std::vector<int>
@@ -61,9 +61,9 @@
             else:
                 iv[i:j:step] = newval
         iv_error = None
-    except ValueError, e:
+    except ValueError as e:
         iv_error = e
-    except IndexError, e:
+    except IndexError as e:
         iv_error = e
 
     # std::list<int>
@@ -79,14 +79,14 @@
             else:
                 il[i:j:step] = newval
         il_error = None
-    except ValueError, e:
+    except ValueError as e:
         il_error = e
-    except IndexError, e:
+    except IndexError as e:
         il_error = e
 
     if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
-        raise RuntimeError, "ValueError exception not consistently thrown: " + \
-            str(ps_error) + " " + str(iv_error) + " " + str(il_error)
+        raise RuntimeError("ValueError exception not consistently thrown: " + \
+            str(ps_error) + " " + str(iv_error) + " " + str(il_error))
 
     compare_containers(ps, iv, il)
 
@@ -94,7 +94,7 @@
 # Check std::vector and std::list delete behaves same as Python list
 # delete including exceptions
 def container_delete_step(i, j, step):
-    ps = range(6)
+    ps = list(range(6))
     iv = vector_int(ps)
     il = list_int(ps)
 
@@ -111,9 +111,9 @@
             else:
                 del ps[i:j:step]
         ps_error = None
-    except ValueError, e:
+    except ValueError as e:
         ps_error = e
-    except IndexError, e:
+    except IndexError as e:
         ps_error = e
 
     # std::vector<int>
@@ -129,9 +129,9 @@
             else:
                 del iv[i:j:step]
         iv_error = None
-    except ValueError, e:
+    except ValueError as e:
         iv_error = e
-    except IndexError, e:
+    except IndexError as e:
         iv_error = e
 
     # std::list<int>
@@ -147,14 +147,14 @@
             else:
                 del il[i:j:step]
         il_error = None
-    except ValueError, e:
+    except ValueError as e:
         il_error = e
-    except IndexError, e:
+    except IndexError as e:
         il_error = e
 
     if not((type(ps_error) == type(iv_error)) and (type(ps_error) == type(il_error))):
-        raise RuntimeError, "ValueError exception not consistently thrown: " + \
-            str(ps_error) + " " + str(iv_error) + " " + str(il_error)
+        raise RuntimeError("ValueError exception not consistently thrown: " + \
+            str(ps_error) + " " + str(iv_error) + " " + str(il_error))
 
     compare_containers(ps, iv, il)
 
@@ -252,7 +252,7 @@
         for step in range(-7, 7):
             container_delete_step(start, end, step)
 
-ps = range(6)
+ps = list(range(6))
 iv = vector_int(ps)
 il = list_int(ps)
 del ps[:]
diff --git a/Examples/test-suite/python/li_std_map_runme.py b/Examples/test-suite/python/li_std_map_runme.py
index ac214dd..765527e 100644
--- a/Examples/test-suite/python/li_std_map_runme.py
+++ b/Examples/test-suite/python/li_std_map_runme.py
@@ -25,8 +25,7 @@
 
 for k in m:
     if pm[k].this != m[k].this:
-        print pm[k], m[k]
-        raise RuntimeError
+        raise RuntimeError("Not equal {} {}".format(pm[k], m[k]))
 
 
 m = {}
@@ -51,31 +50,31 @@
 if mii[1] != 2:
     raise RuntimeError
 
-if mii.keys() != [1]:
+if list(mii.keys()) != [1]:
     raise RuntimeError("keys")
-if mii.values() != [2]:
+if list(mii.values()) != [2]:
     raise RuntimeError("values")
-if mii.items() != [(1, 2)]:
+if list(mii.items()) != [(1, 2)]:
     raise RuntimeError("items")
 
 if [k for k in mii] != [1]:
     raise RuntimeError("iteration")
 
-if [i for i in mii.iterkeys()] != [1]:
+if [i for i in mii.keys()] != [1]:
     raise RuntimeError("iterkeys")
-if [i for i in mii.itervalues()] != [2]:
+if [i for i in mii.values()] != [2]:
     raise RuntimeError("itervalues")
-if [i for i in mii.iteritems()] != [(1, 2)]:
+if [i for i in mii.items()] != [(1, 2)]:
     raise RuntimeError("iteritems")
 
 
 slmap = li_std_map.StringLengthNumberMap()
 li_std_map.populate(slmap)
 
-keys = " ".join([k for k in slmap.keys()])
+keys = " ".join([k for k in list(slmap.keys())])
 if keys != "a aa zzz xxxx aaaaa":
     raise RuntimeError("Keys are wrong or in wrong order: " + keys)
 
-values = " ".join([str(v) for v in slmap.values()])
+values = " ".join([str(v) for v in list(slmap.values())])
 if values != "1 2 3 4 5":
     raise RuntimeError("Values are wrong or in wrong order: " + values)
diff --git a/Examples/test-suite/python/li_std_pair_runme.py b/Examples/test-suite/python/li_std_pair_runme.py
new file mode 100644
index 0000000..4150e5c
--- /dev/null
+++ b/Examples/test-suite/python/li_std_pair_runme.py
@@ -0,0 +1,47 @@
+from li_std_pair import *
+
+def check(flag):
+    if not flag:
+        raise RuntimeError("Check failed")
+
+intPair = makeIntPair(7, 6)
+check(isinstance(intPair, tuple))
+check(len(intPair) == 2)
+check(intPair[0] == 7)
+check(intPair[1] == 6)
+
+intPairConstRef = makeIntPairConstRef(7, 6)
+check(isinstance(intPairConstRef, tuple))
+check(intPairConstRef[0] == 7)
+check(intPairConstRef[1] == 6)
+
+#
+# Each of these should return a reference to a wrapped
+# std::pair<int, int> object (i.e. an IntPair instance).
+#
+intPairPtr = makeIntPairPtr(7, 6)
+check(isinstance(intPairPtr, IntPair))
+check(intPairPtr[0] == 7)
+check(intPairPtr[1] == 6)
+
+intPairRef = makeIntPairRef(7, 6)
+check(isinstance(intPairRef, IntPair))
+check(intPairRef[0] == 7)
+check(intPairRef[1] == 6)
+#
+# Now test various input typemaps. Each of the wrapped C++ functions
+# (product1, product2 and product3) is expecting an argument of a
+# different type (see li_std_pair.i). Typemaps should be in place to
+# convert this tuple into the expected argument type.
+#
+check(product1(intPair) == 42)
+check(product2(intPair) == 42)
+# check(product3(intPair) == 42) # TODO, if desirable to match Ruby wrappers behaviour. Requires equivalent to typemap(in) std::pair* in Lib/ruby/std_pair.i and further fixes to stop recursive calls to swig::asptr which this testcase shows. Plus further changes for any type of sequence type (including other STL containers) to be accepted by all methods taking an STL container to match Ruby behaviour.
+
+#
+# Similarly, each of the input typemaps should know what to do
+# with an IntPair instance.
+#
+check(product1(intPairPtr) == 42)
+check(product2(intPairPtr) == 42)
+check(product3(intPairPtr) == 42)
diff --git a/Examples/test-suite/python/li_std_set_runme.py b/Examples/test-suite/python/li_std_set_runme.py
index 5e5b724..34a1eb1 100644
--- a/Examples/test-suite/python/li_std_set_runme.py
+++ b/Examples/test-suite/python/li_std_set_runme.py
@@ -14,11 +14,11 @@
     raise RuntimeError
 
 i = s.__iter__()
-if i.next() != "a":
+if next(i) != "a":
     raise RuntimeError
-if i.next() != "b":
+if next(i) != "b":
     raise RuntimeError
-if i.next() != "c":
+if next(i) != "c":
     raise RuntimeError
 
 
@@ -26,7 +26,7 @@
 e = s.end()
 sum = ""
 while (b != e):
-    sum = sum + b.next()
+    sum = sum + next(b)
 if sum != "abc":
     raise RuntimeError
 
@@ -34,7 +34,7 @@
 e = s.rend()
 sum = ""
 while (b != e):
-    sum = sum + b.next()
+    sum = sum + next(b)
 
 if sum != "cba":
     raise RuntimeError
@@ -47,25 +47,25 @@
 si.append(3)
 i = si.__iter__()
 
-if i.next() != 1:
+if next(i) != 1:
     raise RuntimeError
-if i.next() != 2:
+if next(i) != 2:
     raise RuntimeError
-if i.next() != 3:
+if next(i) != 3:
     raise RuntimeError
 
 if si[0] != 1:
     raise RuntimeError
 
 i = s.begin()
-i.next()
+next(i)
 s.erase(i)
 
 b = s.begin()
 e = s.end()
 sum = ""
 while (b != e):
-    sum = sum + b.next()
+    sum = sum + next(b)
 if sum != "ac":
     raise RuntimeError
 
diff --git a/Examples/test-suite/python/li_std_stream_runme.py b/Examples/test-suite/python/li_std_stream_runme.py
index 08c3088..a4526f0 100644
--- a/Examples/test-suite/python/li_std_stream_runme.py
+++ b/Examples/test-suite/python/li_std_stream_runme.py
@@ -9,5 +9,4 @@
 
 
 if o.str() != "A class 2345 1.435":
-    print "\"%s\"" % (o.str(),)
-    raise RuntimeError
+    raise RuntimeError("str failed: \"%s\"".format(o.str()))
diff --git a/Examples/test-suite/python/li_std_string_extra_runme.py b/Examples/test-suite/python/li_std_string_extra_runme.py
index 087d92b..96c6416 100644
--- a/Examples/test-suite/python/li_std_string_extra_runme.py
+++ b/Examples/test-suite/python/li_std_string_extra_runme.py
@@ -4,17 +4,16 @@
 
 
 if li_std_string_extra.test_ccvalue(x) != x:
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 if li_std_string_extra.test_cvalue(x) != x:
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 if li_std_string_extra.test_value(x) != x:
-    print x, li_std_string_extra.test_value(x)
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping {} {}".format(x, li_std_string_extra.test_value(x)))
 
 if li_std_string_extra.test_const_reference(x) != x:
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 
 s = li_std_string_extra.string("he")
@@ -23,45 +22,43 @@
 s = s + "llo"
 
 if s != x:
-    print s, x
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping {} {}".format(s, x))
 
 if s[1:4] != x[1:4]:
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 if li_std_string_extra.test_value(s) != x:
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 if li_std_string_extra.test_const_reference(s) != x:
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 a = li_std_string_extra.A(s)
 
 if li_std_string_extra.test_value(a) != x:
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 if li_std_string_extra.test_const_reference(a) != x:
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 b = li_std_string_extra.string(" world")
 
 s = a + b
 if a + b != "hello world":
-    print a + b
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping {}".format(a + b))
 
 if a + " world" != "hello world":
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 # This is expected to fail with -builtin option
 # Reverse operators not supported in builtin types
 if not li_std_string_extra.is_python_builtin():
     if "hello" + b != "hello world":
-        raise RuntimeError, "bad string mapping"
+        raise RuntimeError("bad string mapping")
 
     c = "hello" + b
     if c.find_last_of("l") != 9:
-        raise RuntimeError, "bad string mapping"
+        raise RuntimeError("bad string mapping")
 
 s = "hello world"
 
@@ -69,33 +66,33 @@
 
 b.name = li_std_string_extra.string("hello")
 if b.name != "hello":
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 
 b.a = li_std_string_extra.A("hello")
 if b.a != "hello":
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 
 if li_std_string_extra.test_value_basic1(x) != x:
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 if li_std_string_extra.test_value_basic2(x) != x:
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 
 if li_std_string_extra.test_value_basic3(x) != x:
-    raise RuntimeError, "bad string mapping"
+    raise RuntimeError("bad string mapping")
 
 if li_std_string_extra.test_value_basic_overload(x) != x:
-    raise RuntimeError, "bad overload string"
+    raise RuntimeError("bad overload string")
 
 if li_std_string_extra.test_value_basic_overload(123) != "int":
-    raise RuntimeError, "bad overload int"
+    raise RuntimeError("bad overload int")
 
 try:
     li_std_string_extra.test_value_basic_overload([x])
-    raise RuntimeError, "should throw TypeError"
+    raise RuntimeError("should throw TypeError")
 except TypeError as e:
     if str(e).find("Possible C/C++ prototypes are:") == -1:
         raise RuntimeError("Incorrect error message text:\n{}".format(e))
@@ -103,7 +100,7 @@
 
 try:
     li_std_string_extra.test_value_basic_overload([123])
-    raise RuntimeError, "should throw TypeError"
+    raise RuntimeError("should throw TypeError")
 except TypeError as e:
     if str(e).find("Possible C/C++ prototypes are:") == -1:
         raise RuntimeError("Incorrect error message text:\n{}".format(e))
@@ -112,30 +109,30 @@
 # Global variables
 s = "initial string"
 if li_std_string_extra.cvar.GlobalString2 != "global string 2":
-    raise RuntimeError, "GlobalString2 test 1"
+    raise RuntimeError("GlobalString2 test 1")
 li_std_string_extra.cvar.GlobalString2 = s
 if li_std_string_extra.cvar.GlobalString2 != s:
-    raise RuntimeError, "GlobalString2 test 2"
+    raise RuntimeError("GlobalString2 test 2")
 if li_std_string_extra.cvar.ConstGlobalString != "const global string":
-    raise RuntimeError, "ConstGlobalString test"
+    raise RuntimeError("ConstGlobalString test")
 
 # Member variables
 myStructure = li_std_string_extra.Structure()
 if myStructure.MemberString2 != "member string 2":
-    raise RuntimeError, "MemberString2 test 1"
+    raise RuntimeError("MemberString2 test 1")
 myStructure.MemberString2 = s
 if myStructure.MemberString2 != s:
-    raise RuntimeError, "MemberString2 test 2"
+    raise RuntimeError("MemberString2 test 2")
 if myStructure.ConstMemberString != "const member string":
-    raise RuntimeError, "ConstMemberString test"
+    raise RuntimeError("ConstMemberString test")
 
 if li_std_string_extra.cvar.Structure_StaticMemberString2 != "static member string 2":
-    raise RuntimeError, "StaticMemberString2 test 1"
+    raise RuntimeError("StaticMemberString2 test 1")
 li_std_string_extra.cvar.Structure_StaticMemberString2 = s
 if li_std_string_extra.cvar.Structure_StaticMemberString2 != s:
-    raise RuntimeError, "StaticMemberString2 test 2"
+    raise RuntimeError("StaticMemberString2 test 2")
 if li_std_string_extra.cvar.Structure_ConstStaticMemberString != "const static member string":
-    raise RuntimeError, "ConstStaticMemberString test"
+    raise RuntimeError("ConstStaticMemberString test")
 
 
 if li_std_string_extra.test_reference_input("hello") != "hello":
diff --git a/Examples/test-suite/python/li_std_vector_enum_runme.py b/Examples/test-suite/python/li_std_vector_enum_runme.py
index 318d1bf..587f20b 100644
--- a/Examples/test-suite/python/li_std_vector_enum_runme.py
+++ b/Examples/test-suite/python/li_std_vector_enum_runme.py
@@ -14,7 +14,7 @@
 it = ev.nums.iterator()
 v = it.value()
 check(v, 10)
-it.next()
+next(it)
 v = it.value()
 check(v, 20)
 
diff --git a/Examples/test-suite/python/li_std_vector_extra_runme.py b/Examples/test-suite/python/li_std_vector_extra_runme.py
index 59e729a..4044455 100644
--- a/Examples/test-suite/python/li_std_vector_extra_runme.py
+++ b/Examples/test-suite/python/li_std_vector_extra_runme.py
@@ -23,20 +23,20 @@
 bv[3] = bool(0)
 
 if bv[0] != bv[2]:
-    raise RuntimeError, "bad std::vector<bool> mapping"
+    raise RuntimeError("bad std::vector<bool> mapping")
 
 b = B(5)
 va = VecA([b, None, b, b])
 
 if va[0].f(1) != 6:
-    raise RuntimeError, "bad std::vector<A*> mapping"
+    raise RuntimeError("bad std::vector<A*> mapping")
 
 if vecAptr(va) != 6:
-    raise RuntimeError, "bad std::vector<A*> mapping"
+    raise RuntimeError("bad std::vector<A*> mapping")
 
 b.val = 7
 if va[3].f(1) != 8:
-    raise RuntimeError, "bad std::vector<A*> mapping"
+    raise RuntimeError("bad std::vector<A*> mapping")
 
 
 ip = PtrInt()
@@ -47,7 +47,7 @@
 
 vi = IntPtrVector((ip, ap, None))
 if ArrInt_getitem(vi[0], 0) != ArrInt_getitem(vi[1], 2):
-    raise RuntimeError, "bad std::vector<int*> mapping"
+    raise RuntimeError("bad std::vector<int*> mapping")
 
 delete_ArrInt(ap)
 
@@ -57,42 +57,42 @@
 v = IntVector()
 v[0:2] = [1, 2]
 if v[0] != 1 or v[1] != 2:
-    raise RuntimeError, "bad setslice"
+    raise RuntimeError("bad setslice")
 
 if v[0:-1][0] != 1:
-    raise RuntimeError, "bad getslice"
+    raise RuntimeError("bad getslice")
 
 if v[0:-2].size() != 0:
-    raise RuntimeError, "bad getslice"
+    raise RuntimeError("bad getslice")
 
 v[0:1] = [2]
 if v[0] != 2:
-    raise RuntimeError, "bad setslice"
+    raise RuntimeError("bad setslice")
 
 v[1:] = [3]
 if v[1] != 3:
-    raise RuntimeError, "bad setslice"
+    raise RuntimeError("bad setslice")
 
 v[2:] = [3]
 if v[2] != 3:
-    raise RuntimeError, "bad setslice"
+    raise RuntimeError("bad setslice")
 
 if v[0:][0] != v[0]:
-    raise RuntimeError, "bad getslice"
+    raise RuntimeError("bad getslice")
 
 
 del v[:]
 if v.size() != 0:
-    raise RuntimeError, "bad getslice"
+    raise RuntimeError("bad getslice")
 
 del v[:]
 if v.size() != 0:
-    raise RuntimeError, "bad getslice"
+    raise RuntimeError("bad getslice")
 
 
 v = vecStr(["hello ", "world"])
 if v[0] != "hello world":
-    raise RuntimeError, "bad std::string+std::vector"
+    raise RuntimeError("bad std::string+std::vector")
 
 
 pv = pyvector([1, "hello", (1, 2)])
diff --git a/Examples/test-suite/python/li_std_wstream_runme.py b/Examples/test-suite/python/li_std_wstream_runme.py
index 045645b..0ecdddb 100644
--- a/Examples/test-suite/python/li_std_wstream_runme.py
+++ b/Examples/test-suite/python/li_std_wstream_runme.py
@@ -5,8 +5,7 @@
 
 o = wostringstream()
 
-o << a << u" " << 2345 << u" " << 1.435 << wends
+o << a << " " << 2345 << " " << 1.435 << wends
 
 if o.str() != "A class 2345 1.435\0":
-    print "\"%s\"" % (o.str(),)
-    raise RuntimeError
+    raise RuntimeError("str failed: \"%s\"".format(o.str()))
diff --git a/Examples/test-suite/python/li_std_wstring_inherit_runme.py b/Examples/test-suite/python/li_std_wstring_inherit_runme.py
index 558914e..bd58589 100644
--- a/Examples/test-suite/python/li_std_wstring_inherit_runme.py
+++ b/Examples/test-suite/python/li_std_wstring_inherit_runme.py
@@ -1,14 +1,13 @@
 import li_std_wstring_inherit
 import sys
 
-x = u"hello"
+x = "hello"
 
-s = li_std_wstring_inherit.wstring(u"he")
-s = s + u"llo"
+s = li_std_wstring_inherit.wstring("he")
+s = s + "llo"
 
 if s != x:
-    print s, x
-    raise RuntimeError("bad string mapping")
+    raise RuntimeError("bad string mapping {} {}".format(s, x))
 
 if s[1:4] != x[1:4]:
     raise RuntimeError("bad string mapping")
@@ -34,12 +33,12 @@
 
 b = li_std_wstring_inherit.B("hi")
 
-b.name = li_std_wstring_inherit.wstring(u"hello")
+b.name = li_std_wstring_inherit.wstring("hello")
 if b.name != "hello":
     raise RuntimeError("bad string mapping")
 
 
 b.a = li_std_wstring_inherit.A("hello")
-if b.a != u"hello":
+if b.a != "hello":
     raise RuntimeError("bad string mapping")
 
diff --git a/Examples/test-suite/python/li_std_wstring_runme.py b/Examples/test-suite/python/li_std_wstring_runme.py
index c6210e2..ca8dc31 100644
--- a/Examples/test-suite/python/li_std_wstring_runme.py
+++ b/Examples/test-suite/python/li_std_wstring_runme.py
@@ -5,10 +5,10 @@
     if a != b:
         raise RuntimeError("failed {} {}".format(a, b))
 
-h = u"h"
+h = "h"
 check_equal(li_std_wstring.test_wcvalue(h), h)
 
-x = u"abc"
+x = "abc"
 check_equal(li_std_wstring.test_ccvalue(x), x)
 check_equal(li_std_wstring.test_cvalue(x), x)
 
@@ -54,6 +54,12 @@
 check_equal(li_std_wstring.test_ccvalue(x), "abc")
 check_equal(li_std_wstring.test_wchar_overload(x), "abc")
 
+ts = li_std_wstring.wchar_test_struct()
+ts.wchar_t_member = h
+check_equal(ts.wchar_t_member, h)
+ts.wchar_t_ptr_member = s
+check_equal(ts.wchar_t_ptr_member, s)
+
 ################### Python specific
 
 # Byte strings only converted in Python 2
@@ -72,7 +78,7 @@
 
 # Check surrogateescape
 if sys.version_info[0:2] > (3, 1):
-    x = u"h\udce9llo"  # surrogate escaped representation of C char*: "h\xe9llo"
+    x = "h\udce9llo"  # surrogate escaped representation of C char*: "h\xe9llo"
     if li_std_wstring.non_utf8_c_str() != x:
         raise RuntimeError("surrogateescape not working")
     if li_std_wstring.size_wstring(x) != 5 and len(x) != 5:
diff --git a/Examples/test-suite/python/minherit_runme.py b/Examples/test-suite/python/minherit_runme.py
index b7e7d01..8638d23 100644
--- a/Examples/test-suite/python/minherit_runme.py
+++ b/Examples/test-suite/python/minherit_runme.py
@@ -7,31 +7,31 @@
 d = minherit.Spam()
 
 if a.xget() != 1:
-    raise RuntimeError, "Bad attribute value"
+    raise RuntimeError("Bad attribute value")
 
 if b.yget() != 2:
-    raise RuntimeError, "Bad attribute value"
+    raise RuntimeError("Bad attribute value")
 
 if c.xget() != 1 or c.yget() != 2 or c.zget() != 3:
-    raise RuntimeError, "Bad attribute value"
+    raise RuntimeError("Bad attribute value")
 
 if d.xget() != 1 or d.yget() != 2 or d.zget() != 3 or d.wget() != 4:
-    raise RuntimeError, "Bad attribute value"
+    raise RuntimeError("Bad attribute value")
 
 
 if minherit.xget(a) != 1:
-    raise RuntimeError, "Bad attribute value %d" % (minherit.xget(a))
+    raise RuntimeError("Bad attribute value %d" % (minherit.xget(a)))
 
 if minherit.yget(b) != 2:
-    raise RuntimeError, "Bad attribute value %d" % (minherit.yget(b))
+    raise RuntimeError("Bad attribute value %d" % (minherit.yget(b)))
 
 if minherit.xget(c) != 1 or minherit.yget(c) != 2 or minherit.zget(c) != 3:
-    raise RuntimeError, "Bad attribute value %d %d %d" % (
-        minherit.xget(c), minherit.yget(c), minherit.zget(c))
+    raise RuntimeError("Bad attribute value %d %d %d" % (
+        minherit.xget(c), minherit.yget(c), minherit.zget(c)))
 
 if minherit.xget(d) != 1 or minherit.yget(d) != 2 or minherit.zget(d) != 3 or minherit.wget(d) != 4:
-    raise RuntimeError, "Bad attribute value %d %d %d %d" % (
-        minherit.xget(d), minherit.yget(d), minherit.zget(d), minherit.wget(d))
+    raise RuntimeError("Bad attribute value %d %d %d %d" % (
+        minherit.xget(d), minherit.yget(d), minherit.zget(d), minherit.wget(d)))
 
 # Cleanse all of the pointers and see what happens
 
@@ -41,27 +41,27 @@
 dd = minherit.toSpamPtr(d)
 
 if aa.xget() != 1:
-    raise RuntimeError, "Bad attribute value"
+    raise RuntimeError("Bad attribute value")
 
 if bb.yget() != 2:
-    raise RuntimeError, "Bad attribute value"
+    raise RuntimeError("Bad attribute value")
 
 if cc.xget() != 1 or cc.yget() != 2 or cc.zget() != 3:
-    raise RuntimeError, "Bad attribute value"
+    raise RuntimeError("Bad attribute value")
 
 if dd.xget() != 1 or dd.yget() != 2 or dd.zget() != 3 or dd.wget() != 4:
-    raise RuntimeError, "Bad attribute value"
+    raise RuntimeError("Bad attribute value")
 
 if minherit.xget(aa) != 1:
-    raise RuntimeError, "Bad attribute value %d" % (minherit.xget(aa))
+    raise RuntimeError("Bad attribute value %d" % (minherit.xget(aa)))
 
 if minherit.yget(bb) != 2:
-    raise RuntimeError, "Bad attribute value %d" % (minherit.yget(bb))
+    raise RuntimeError("Bad attribute value %d" % (minherit.yget(bb)))
 
 if minherit.xget(cc) != 1 or minherit.yget(cc) != 2 or minherit.zget(cc) != 3:
-    raise RuntimeError, "Bad attribute value %d %d %d" % (
-        minherit.xget(cc), minherit.yget(cc), minherit.zget(cc))
+    raise RuntimeError("Bad attribute value %d %d %d" % (
+        minherit.xget(cc), minherit.yget(cc), minherit.zget(cc)))
 
 if minherit.xget(dd) != 1 or minherit.yget(dd) != 2 or minherit.zget(dd) != 3 or minherit.wget(dd) != 4:
-    raise RuntimeError, "Bad attribute value %d %d %d %d" % (
-        minherit.xget(dd), minherit.yget(dd), minherit.zget(dd), minherit.wget(dd))
+    raise RuntimeError("Bad attribute value %d %d %d %d" % (
+        minherit.xget(dd), minherit.yget(dd), minherit.zget(dd), minherit.wget(dd)))
diff --git a/Examples/test-suite/python/namespace_class_runme.py b/Examples/test-suite/python/namespace_class_runme.py
index aa51655..9349f24 100644
--- a/Examples/test-suite/python/namespace_class_runme.py
+++ b/Examples/test-suite/python/namespace_class_runme.py
@@ -7,7 +7,7 @@
     error = 0
 
 if (error):
-    raise RuntimeError, "Private1 is private"
+    raise RuntimeError("Private1 is private")
 
 try:
     p = Private2()
@@ -16,7 +16,7 @@
     error = 0
 
 if (error):
-    raise RuntimeError, "Private2 is private"
+    raise RuntimeError("Private2 is private")
 
 EulerT3D.toFrame(1, 1, 1)
 
diff --git a/Examples/test-suite/python/overload_complicated_runme.py b/Examples/test-suite/python/overload_complicated_runme.py
index 2593c4f..8794da1 100644
--- a/Examples/test-suite/python/overload_complicated_runme.py
+++ b/Examples/test-suite/python/overload_complicated_runme.py
@@ -10,38 +10,38 @@
 # Check overloaded in const only and pointers/references which target
 # languages cannot disambiguate
 if p.hip(False) != 701:
-    raise RuntimeError, "Test 1 failed"
+    raise RuntimeError("Test 1 failed")
 
 if p.hip(pInt) != 702:
-    raise RuntimeError, "Test 2 failed"
+    raise RuntimeError("Test 2 failed")
 
 # Reverse the order for the above
 if p.hop(pInt) != 805:
-    raise RuntimeError, "Test 3 failed"
+    raise RuntimeError("Test 3 failed")
 
 if p.hop(False) != 801:
-    raise RuntimeError, "Test 4 failed"
+    raise RuntimeError("Test 4 failed")
 
 # Few more variations and order shuffled
 if p.pop(False) != 901:
-    raise RuntimeError, "Test 5 failed"
+    raise RuntimeError("Test 5 failed")
 
 if p.pop(pInt) != 904:
-    raise RuntimeError, "Test 6 failed"
+    raise RuntimeError("Test 6 failed")
 
 if p.pop() != 905:
-    raise RuntimeError, "Test 7 failed"
+    raise RuntimeError("Test 7 failed")
 
 # Overload on const only
 if p.bop(pInt) != 1001:
-    raise RuntimeError, "Test 8 failed"
+    raise RuntimeError("Test 8 failed")
 
 if p.bip(pInt) != 2002:
-    raise RuntimeError, "Test 9 failed"
+    raise RuntimeError("Test 9 failed")
 
 # Globals
 if muzak(False) != 3001:
-    raise RuntimeError, "Test 10 failed"
+    raise RuntimeError("Test 10 failed")
 
 if muzak(pInt) != 3002:
-    raise RuntimeError, "Test 11 failed"
+    raise RuntimeError("Test 11 failed")
diff --git a/Examples/test-suite/python/overload_simple_runme.py b/Examples/test-suite/python/overload_simple_runme.py
index 6d72ec0..8ad813b 100644
--- a/Examples/test-suite/python/overload_simple_runme.py
+++ b/Examples/test-suite/python/overload_simple_runme.py
@@ -1,95 +1,95 @@
 from overload_simple import *
 
 if foo(3) != "foo:int":
-    raise RuntimeError, "foo(int)"
+    raise RuntimeError("foo(int)")
 
 if foo(3.0) != "foo:double":
-    raise RuntimeError, "foo(double)"
+    raise RuntimeError("foo(double)")
 
 if foo("hello") != "foo:char *":
-    raise RuntimeError, "foo(char *)"
+    raise RuntimeError("foo(char *)")
 
 f = Foo()
 b = Bar()
 
 if foo(f) != "foo:Foo *":
-    raise RuntimeError, "foo(Foo *)"
+    raise RuntimeError("foo(Foo *)")
 
 if foo(b) != "foo:Bar *":
-    raise RuntimeError, "foo(Bar *)"
+    raise RuntimeError("foo(Bar *)")
 
 v = malloc_void(32)
 
 if foo(v) != "foo:void *":
-    raise RuntimeError, "foo(void *)"
+    raise RuntimeError("foo(void *)")
 
 s = Spam()
 
 if s.foo(3) != "foo:int":
-    raise RuntimeError, "Spam::foo(int)"
+    raise RuntimeError("Spam::foo(int)")
 
 if s.foo(3.0) != "foo:double":
-    raise RuntimeError, "Spam::foo(double)"
+    raise RuntimeError("Spam::foo(double)")
 
 if s.foo("hello") != "foo:char *":
-    raise RuntimeError, "Spam::foo(char *)"
+    raise RuntimeError("Spam::foo(char *)")
 
 if s.foo(f) != "foo:Foo *":
-    raise RuntimeError, "Spam::foo(Foo *)"
+    raise RuntimeError("Spam::foo(Foo *)")
 
 if s.foo(b) != "foo:Bar *":
-    raise RuntimeError, "Spam::foo(Bar *)"
+    raise RuntimeError("Spam::foo(Bar *)")
 
 if s.foo(v) != "foo:void *":
-    raise RuntimeError, "Spam::foo(void *)"
+    raise RuntimeError("Spam::foo(void *)")
 
 if Spam_bar(3) != "bar:int":
-    raise RuntimeError, "Spam::bar(int)"
+    raise RuntimeError("Spam::bar(int)")
 
 if Spam_bar(3.0) != "bar:double":
-    raise RuntimeError, "Spam::bar(double)"
+    raise RuntimeError("Spam::bar(double)")
 
 if Spam_bar("hello") != "bar:char *":
-    raise RuntimeError, "Spam::bar(char *)"
+    raise RuntimeError("Spam::bar(char *)")
 
 if Spam_bar(f) != "bar:Foo *":
-    raise RuntimeError, "Spam::bar(Foo *)"
+    raise RuntimeError("Spam::bar(Foo *)")
 
 if Spam_bar(b) != "bar:Bar *":
-    raise RuntimeError, "Spam::bar(Bar *)"
+    raise RuntimeError("Spam::bar(Bar *)")
 
 if Spam_bar(v) != "bar:void *":
-    raise RuntimeError, "Spam::bar(void *)"
+    raise RuntimeError("Spam::bar(void *)")
 
 # Test constructors
 
 s = Spam()
 if s.type != "none":
-    raise RuntimeError, "Spam()"
+    raise RuntimeError("Spam()")
 
 s = Spam(3)
 if s.type != "int":
-    raise RuntimeError, "Spam(int)"
+    raise RuntimeError("Spam(int)")
 
 s = Spam(3.4)
 if s.type != "double":
-    raise RuntimeError, "Spam(double)"
+    raise RuntimeError("Spam(double)")
 
 s = Spam("hello")
 if s.type != "char *":
-    raise RuntimeError, "Spam(char *)"
+    raise RuntimeError("Spam(char *)")
 
 s = Spam(f)
 if s.type != "Foo *":
-    raise RuntimeError, "Spam(Foo *)"
+    raise RuntimeError("Spam(Foo *)")
 
 s = Spam(b)
 if s.type != "Bar *":
-    raise RuntimeError, "Spam(Bar *)"
+    raise RuntimeError("Spam(Bar *)")
 
 s = Spam(v)
 if s.type != "void *":
-    raise RuntimeError, "Spam(void *)"
+    raise RuntimeError("Spam(void *)")
 
 
 free_void(v)
diff --git a/Examples/test-suite/python/overload_subtype_runme.py b/Examples/test-suite/python/overload_subtype_runme.py
index 3f32a55..b02e62f 100644
--- a/Examples/test-suite/python/overload_subtype_runme.py
+++ b/Examples/test-suite/python/overload_subtype_runme.py
@@ -4,7 +4,7 @@
 b = Bar()
 
 if spam(f) != 1:
-    raise RuntimeError, "foo"
+    raise RuntimeError("foo")
 
 if spam(b) != 2:
-    raise RuntimeError, "bar"
+    raise RuntimeError("bar")
diff --git a/Examples/test-suite/python/overload_template_fast_runme.py b/Examples/test-suite/python/overload_template_fast_runme.py
index ca3cac9..e4eb332 100644
--- a/Examples/test-suite/python/overload_template_fast_runme.py
+++ b/Examples/test-suite/python/overload_template_fast_runme.py
@@ -7,74 +7,74 @@
 
 # mix 1
 if (mix1("hi") != 101):
-    raise RuntimeError, ("mix1(const char*)")
+    raise RuntimeError(("mix1(const char*)"))
 
 if (mix1(1.0, 1.0) != 102):
-    raise RuntimeError, ("mix1(double, const double &)")
+    raise RuntimeError(("mix1(double, const double &)"))
 
 if (mix1(1.0) != 103):
-    raise RuntimeError, ("mix1(double)")
+    raise RuntimeError(("mix1(double)"))
 
 # mix 2
 if (mix2("hi") != 101):
-    raise RuntimeError, ("mix2(const char*)")
+    raise RuntimeError(("mix2(const char*)"))
 
 if (mix2(1.0, 1.0) != 102):
-    raise RuntimeError, ("mix2(double, const double &)")
+    raise RuntimeError(("mix2(double, const double &)"))
 
 if (mix2(1.0) != 103):
-    raise RuntimeError, ("mix2(double)")
+    raise RuntimeError(("mix2(double)"))
 
 # mix 3
 if (mix3("hi") != 101):
-    raise RuntimeError, ("mix3(const char*)")
+    raise RuntimeError(("mix3(const char*)"))
 
 if (mix3(1.0, 1.0) != 102):
-    raise RuntimeError, ("mix3(double, const double &)")
+    raise RuntimeError(("mix3(double, const double &)"))
 
 if (mix3(1.0) != 103):
-    raise RuntimeError, ("mix3(double)")
+    raise RuntimeError(("mix3(double)"))
 
 # Combination 1
 if (overtparams1(100) != 10):
-    raise RuntimeError, ("overtparams1(int)")
+    raise RuntimeError(("overtparams1(int)"))
 
 if (overtparams1(100.0, 100) != 20):
-    raise RuntimeError, ("overtparams1(double, int)")
+    raise RuntimeError(("overtparams1(double, int)"))
 
 # Combination 2
 if (overtparams2(100.0, 100) != 40):
-    raise RuntimeError, ("overtparams2(double, int)")
+    raise RuntimeError(("overtparams2(double, int)"))
 
 # Combination 3
 if (overloaded() != 60):
-    raise RuntimeError, ("overloaded()")
+    raise RuntimeError(("overloaded()"))
 
 if (overloaded(100.0, 100) != 70):
-    raise RuntimeError, ("overloaded(double, int)")
+    raise RuntimeError(("overloaded(double, int)"))
 
 # Combination 4
 if (overloadedagain("hello") != 80):
-    raise RuntimeError, ("overloadedagain(const char *)")
+    raise RuntimeError(("overloadedagain(const char *)"))
 
 if (overloadedagain() != 90):
-    raise RuntimeError, ("overloadedagain(double)")
+    raise RuntimeError(("overloadedagain(double)"))
 
 # specializations
 if (specialization(10) != 202):
-    raise RuntimeError, ("specialization(int)")
+    raise RuntimeError(("specialization(int)"))
 
 if (specialization(10.0) != 203):
-    raise RuntimeError, ("specialization(double)")
+    raise RuntimeError(("specialization(double)"))
 
 if (specialization(10, 10) != 204):
-    raise RuntimeError, ("specialization(int, int)")
+    raise RuntimeError(("specialization(int, int)"))
 
 if (specialization(10.0, 10.0) != 205):
-    raise RuntimeError, ("specialization(double, double)")
+    raise RuntimeError(("specialization(double, double)"))
 
 if (specialization("hi", "hi") != 201):
-    raise RuntimeError, ("specialization(const char *, const char *)")
+    raise RuntimeError(("specialization(const char *, const char *)"))
 
 
 # simple specialization
@@ -84,61 +84,61 @@
 
 # a bit of everything
 if (overload("hi") != 0):
-    raise RuntimeError, ("overload()")
+    raise RuntimeError(("overload()"))
 
 if (overload(1) != 10):
-    raise RuntimeError, ("overload(int t)")
+    raise RuntimeError(("overload(int t)"))
 
 if (overload(1, 1) != 20):
-    raise RuntimeError, ("overload(int t, const int &)")
+    raise RuntimeError(("overload(int t, const int &)"))
 
 if (overload(1, "hello") != 30):
-    raise RuntimeError, ("overload(int t, const char *)")
+    raise RuntimeError(("overload(int t, const char *)"))
 
 k = Klass()
 if (overload(k) != 10):
-    raise RuntimeError, ("overload(Klass t)")
+    raise RuntimeError(("overload(Klass t)"))
 
 if (overload(k, k) != 20):
-    raise RuntimeError, ("overload(Klass t, const Klass &)")
+    raise RuntimeError(("overload(Klass t, const Klass &)"))
 
 if (overload(k, "hello") != 30):
-    raise RuntimeError, ("overload(Klass t, const char *)")
+    raise RuntimeError(("overload(Klass t, const char *)"))
 
 if (overload(10.0, "hi") != 40):
-    raise RuntimeError, ("overload(double t, const char *)")
+    raise RuntimeError(("overload(double t, const char *)"))
 
 if (overload() != 50):
-    raise RuntimeError, ("overload(const char *)")
+    raise RuntimeError(("overload(const char *)"))
 
 
 # everything put in a namespace
 if (nsoverload("hi") != 1000):
-    raise RuntimeError, ("nsoverload()")
+    raise RuntimeError(("nsoverload()"))
 
 if (nsoverload(1) != 1010):
-    raise RuntimeError, ("nsoverload(int t)")
+    raise RuntimeError(("nsoverload(int t)"))
 
 if (nsoverload(1, 1) != 1020):
-    raise RuntimeError, ("nsoverload(int t, const int &)")
+    raise RuntimeError(("nsoverload(int t, const int &)"))
 
 if (nsoverload(1, "hello") != 1030):
-    raise RuntimeError, ("nsoverload(int t, const char *)")
+    raise RuntimeError(("nsoverload(int t, const char *)"))
 
 if (nsoverload(k) != 1010):
-    raise RuntimeError, ("nsoverload(Klass t)")
+    raise RuntimeError(("nsoverload(Klass t)"))
 
 if (nsoverload(k, k) != 1020):
-    raise RuntimeError, ("nsoverload(Klass t, const Klass &)")
+    raise RuntimeError(("nsoverload(Klass t, const Klass &)"))
 
 if (nsoverload(k, "hello") != 1030):
-    raise RuntimeError, ("nsoverload(Klass t, const char *)")
+    raise RuntimeError(("nsoverload(Klass t, const char *)"))
 
 if (nsoverload(10.0, "hi") != 1040):
-    raise RuntimeError, ("nsoverload(double t, const char *)")
+    raise RuntimeError(("nsoverload(double t, const char *)"))
 
 if (nsoverload() != 1050):
-    raise RuntimeError, ("nsoverload(const char *)")
+    raise RuntimeError(("nsoverload(const char *)"))
 
 
 A.foo(1)
diff --git a/Examples/test-suite/python/overload_template_runme.py b/Examples/test-suite/python/overload_template_runme.py
index 014ec71..a484d8f 100644
--- a/Examples/test-suite/python/overload_template_runme.py
+++ b/Examples/test-suite/python/overload_template_runme.py
@@ -6,74 +6,74 @@
 
 # mix 1
 if (mix1("hi") != 101):
-    raise RuntimeError, ("mix1(const char*)")
+    raise RuntimeError(("mix1(const char*)"))
 
 if (mix1(1.0, 1.0) != 102):
-    raise RuntimeError, ("mix1(double, const double &)")
+    raise RuntimeError(("mix1(double, const double &)"))
 
 if (mix1(1.0) != 103):
-    raise RuntimeError, ("mix1(double)")
+    raise RuntimeError(("mix1(double)"))
 
 # mix 2
 if (mix2("hi") != 101):
-    raise RuntimeError, ("mix2(const char*)")
+    raise RuntimeError(("mix2(const char*)"))
 
 if (mix2(1.0, 1.0) != 102):
-    raise RuntimeError, ("mix2(double, const double &)")
+    raise RuntimeError(("mix2(double, const double &)"))
 
 if (mix2(1.0) != 103):
-    raise RuntimeError, ("mix2(double)")
+    raise RuntimeError(("mix2(double)"))
 
 # mix 3
 if (mix3("hi") != 101):
-    raise RuntimeError, ("mix3(const char*)")
+    raise RuntimeError(("mix3(const char*)"))
 
 if (mix3(1.0, 1.0) != 102):
-    raise RuntimeError, ("mix3(double, const double &)")
+    raise RuntimeError(("mix3(double, const double &)"))
 
 if (mix3(1.0) != 103):
-    raise RuntimeError, ("mix3(double)")
+    raise RuntimeError(("mix3(double)"))
 
 # Combination 1
 if (overtparams1(100) != 10):
-    raise RuntimeError, ("overtparams1(int)")
+    raise RuntimeError(("overtparams1(int)"))
 
 if (overtparams1(100.0, 100) != 20):
-    raise RuntimeError, ("overtparams1(double, int)")
+    raise RuntimeError(("overtparams1(double, int)"))
 
 # Combination 2
 if (overtparams2(100.0, 100) != 40):
-    raise RuntimeError, ("overtparams2(double, int)")
+    raise RuntimeError(("overtparams2(double, int)"))
 
 # Combination 3
 if (overloaded() != 60):
-    raise RuntimeError, ("overloaded()")
+    raise RuntimeError(("overloaded()"))
 
 if (overloaded(100.0, 100) != 70):
-    raise RuntimeError, ("overloaded(double, int)")
+    raise RuntimeError(("overloaded(double, int)"))
 
 # Combination 4
 if (overloadedagain("hello") != 80):
-    raise RuntimeError, ("overloadedagain(const char *)")
+    raise RuntimeError(("overloadedagain(const char *)"))
 
 if (overloadedagain() != 90):
-    raise RuntimeError, ("overloadedagain(double)")
+    raise RuntimeError(("overloadedagain(double)"))
 
 # specializations
 if (specialization(10) != 202):
-    raise RuntimeError, ("specialization(int)")
+    raise RuntimeError(("specialization(int)"))
 
 if (specialization(10.0) != 203):
-    raise RuntimeError, ("specialization(double)")
+    raise RuntimeError(("specialization(double)"))
 
 if (specialization(10, 10) != 204):
-    raise RuntimeError, ("specialization(int, int)")
+    raise RuntimeError(("specialization(int, int)"))
 
 if (specialization(10.0, 10.0) != 205):
-    raise RuntimeError, ("specialization(double, double)")
+    raise RuntimeError(("specialization(double, double)"))
 
 if (specialization("hi", "hi") != 201):
-    raise RuntimeError, ("specialization(const char *, const char *)")
+    raise RuntimeError(("specialization(const char *, const char *)"))
 
 
 # simple specialization
@@ -83,61 +83,61 @@
 
 # a bit of everything
 if (overload("hi") != 0):
-    raise RuntimeError, ("overload()")
+    raise RuntimeError(("overload()"))
 
 if (overload(1) != 10):
-    raise RuntimeError, ("overload(int t)")
+    raise RuntimeError(("overload(int t)"))
 
 if (overload(1, 1) != 20):
-    raise RuntimeError, ("overload(int t, const int &)")
+    raise RuntimeError(("overload(int t, const int &)"))
 
 if (overload(1, "hello") != 30):
-    raise RuntimeError, ("overload(int t, const char *)")
+    raise RuntimeError(("overload(int t, const char *)"))
 
 k = Klass()
 if (overload(k) != 10):
-    raise RuntimeError, ("overload(Klass t)")
+    raise RuntimeError(("overload(Klass t)"))
 
 if (overload(k, k) != 20):
-    raise RuntimeError, ("overload(Klass t, const Klass &)")
+    raise RuntimeError(("overload(Klass t, const Klass &)"))
 
 if (overload(k, "hello") != 30):
-    raise RuntimeError, ("overload(Klass t, const char *)")
+    raise RuntimeError(("overload(Klass t, const char *)"))
 
 if (overload(10.0, "hi") != 40):
-    raise RuntimeError, ("overload(double t, const char *)")
+    raise RuntimeError(("overload(double t, const char *)"))
 
 if (overload() != 50):
-    raise RuntimeError, ("overload(const char *)")
+    raise RuntimeError(("overload(const char *)"))
 
 
 # everything put in a namespace
 if (nsoverload("hi") != 1000):
-    raise RuntimeError, ("nsoverload()")
+    raise RuntimeError(("nsoverload()"))
 
 if (nsoverload(1) != 1010):
-    raise RuntimeError, ("nsoverload(int t)")
+    raise RuntimeError(("nsoverload(int t)"))
 
 if (nsoverload(1, 1) != 1020):
-    raise RuntimeError, ("nsoverload(int t, const int &)")
+    raise RuntimeError(("nsoverload(int t, const int &)"))
 
 if (nsoverload(1, "hello") != 1030):
-    raise RuntimeError, ("nsoverload(int t, const char *)")
+    raise RuntimeError(("nsoverload(int t, const char *)"))
 
 if (nsoverload(k) != 1010):
-    raise RuntimeError, ("nsoverload(Klass t)")
+    raise RuntimeError(("nsoverload(Klass t)"))
 
 if (nsoverload(k, k) != 1020):
-    raise RuntimeError, ("nsoverload(Klass t, const Klass &)")
+    raise RuntimeError(("nsoverload(Klass t, const Klass &)"))
 
 if (nsoverload(k, "hello") != 1030):
-    raise RuntimeError, ("nsoverload(Klass t, const char *)")
+    raise RuntimeError(("nsoverload(Klass t, const char *)"))
 
 if (nsoverload(10.0, "hi") != 1040):
-    raise RuntimeError, ("nsoverload(double t, const char *)")
+    raise RuntimeError(("nsoverload(double t, const char *)"))
 
 if (nsoverload() != 1050):
-    raise RuntimeError, ("nsoverload(const char *)")
+    raise RuntimeError(("nsoverload(const char *)"))
 
 
 A_foo(1)
diff --git a/Examples/test-suite/python/pointer_reference_runme.py b/Examples/test-suite/python/pointer_reference_runme.py
index b9b4788..f126486 100644
--- a/Examples/test-suite/python/pointer_reference_runme.py
+++ b/Examples/test-suite/python/pointer_reference_runme.py
@@ -2,15 +2,15 @@
 
 s = pointer_reference.get()
 if s.value != 10:
-    raise RuntimeError, "get test failed"
+    raise RuntimeError("get test failed")
 
 ss = pointer_reference.Struct(20)
 pointer_reference.set(ss)
 if pointer_reference.cvar.Struct_instance.value != 20:
-    raise RuntimeError, "set test failed"
+    raise RuntimeError("set test failed")
 
 if pointer_reference.overloading(1) != 111:
-    raise RuntimeError, "overload test 1 failed"
+    raise RuntimeError("overload test 1 failed")
 
 if pointer_reference.overloading(ss) != 222:
-    raise RuntimeError, "overload test 2 failed"
+    raise RuntimeError("overload test 2 failed")
diff --git a/Examples/test-suite/python/primitive_types_runme.py b/Examples/test-suite/python/primitive_types_runme.py
index 04588dd..7ed4b52 100644
--- a/Examples/test-suite/python/primitive_types_runme.py
+++ b/Examples/test-suite/python/primitive_types_runme.py
@@ -31,8 +31,7 @@
 
 
 def pyerror(name, val, cte):
-    print "bad val/cte", name, val, cte
-    raise RuntimeError
+    raise RuntimeError("bad val/cte {} {} {}".format(name, val, cte))
     pass
 
 if cvar.var_bool != cct_bool:
@@ -173,7 +172,7 @@
 
 # internal call check
 if t.c_check() != p.c_check():
-    raise RuntimeError, "bad director"
+    raise RuntimeError("bad director")
 
 p.var_bool = p.stc_bool
 p.var_schar = p.stc_schar
@@ -228,63 +227,57 @@
 
 # this value contains a '0' char!
 if def_namet != "hola":
-    print "bad namet", def_namet
-    raise RuntimeError
+    raise RuntimeError("bad namet {}".format(def_namet))
 
 t.var_namet = def_namet
 if t.var_namet != def_namet:
-    print "bad namet", t.var_namet, def_namet
-    raise RuntimeError
+    raise RuntimeError("bad namet {} {}".format(t.var_namet, def_namet))
 
 t.var_namet = "hola"
 
 if t.var_namet != "hola":
-    print "bad namet", t.var_namet
-    raise RuntimeError
+    raise RuntimeError("bad namet {}".format(t.var_namet))
 
 t.var_namet = "hol"
 
 if t.var_namet != "hol":
     # if t.var_namet != "hol\0\0":
-    print "bad namet", t.var_namet
-    raise RuntimeError
+    raise RuntimeError("bad namet {}".format(t.var_namet))
 
 
 cvar.var_char = "\0"
 if cvar.var_char != "\0":
-    raise RuntimeError, "bad char '0' case"
+    raise RuntimeError("bad char '0' case")
 
 cvar.var_char = 0
 if cvar.var_char != "\0":
-    raise RuntimeError, "bad char '0' case"
+    raise RuntimeError("bad char '0' case")
 
 cvar.var_namet = "\0"
 # if cvar.var_namet != "\0\0\0\0\0":
 if cvar.var_namet != "":
-    print "hola", "", cvar.var_namet
-    raise RuntimeError, "bad char '\0' case"
+    raise RuntimeError("bad char '\0' case hola {}".format(cvar.var_namet))
 
 cvar.var_namet = ""
 # if cvar.var_namet != "\0\0\0\0\0":
 if cvar.var_namet != "":
-    raise RuntimeError, "bad char empty case"
+    raise RuntimeError("bad char empty case")
 
 cvar.var_pchar = None
 if cvar.var_pchar != None:
-    raise RuntimeError, "bad None case"
+    raise RuntimeError("bad None case")
 
 cvar.var_pchar = ""
 if cvar.var_pchar != "":
-    print "%c" % (cvar.var_pchar[0],)
-    raise RuntimeError, "bad char empty case"
+    raise RuntimeError("bad char empty case %c" % (cvar.var_pchar[0],))
 
 cvar.var_pcharc = None
 if cvar.var_pcharc != None:
-    raise RuntimeError, "bad None case"
+    raise RuntimeError("bad None case")
 
 cvar.var_pcharc = ""
 if cvar.var_pcharc != "":
-    raise RuntimeError, "bad char empty case"
+    raise RuntimeError("bad char empty case")
 
 
 #
@@ -300,13 +293,12 @@
 
 cvar.var_pchar = pc
 if cvar.var_pchar != "hola":
-    print cvar.var_pchar
-    raise RuntimeError, "bad pointer case"
+    raise RuntimeError("bad pointer case {}".format(cvar.var_pchar))
 
 cvar.var_namet = pc
 # if cvar.var_namet != "hola\0":
 if cvar.var_namet != "hola":
-    raise RuntimeError, "bad pointer case"
+    raise RuntimeError("bad pointer case")
 
 delete_pchar(pc)
 
@@ -325,7 +317,7 @@
         error = 1
     pass
 if error:
-    raise RuntimeError, "bad uchar typemap"
+    raise RuntimeError("bad uchar typemap")
 
 
 try:
@@ -338,7 +330,7 @@
         error = 1
     pass
 if error:
-    raise RuntimeError, "bad char typemap"
+    raise RuntimeError("bad char typemap")
 
 try:
     error = 0
@@ -350,7 +342,7 @@
         error = 1
     pass
 if error:
-    raise RuntimeError, "bad ushort typemap"
+    raise RuntimeError("bad ushort typemap")
 
 try:
     error = 0
@@ -362,7 +354,7 @@
         error = 1
     pass
 if error:
-    raise RuntimeError, "bad uint typemap"
+    raise RuntimeError("bad uint typemap")
 
 try:
     error = 0
@@ -374,7 +366,7 @@
         error = 1
     pass
 if error:
-    raise RuntimeError, "bad sizet typemap"
+    raise RuntimeError("bad sizet typemap")
 
 try:
     error = 0
@@ -386,7 +378,7 @@
         error = 1
     pass
 if error:
-    raise RuntimeError, "bad ulong typemap"
+    raise RuntimeError("bad ulong typemap")
 
 #
 #
@@ -400,43 +392,43 @@
         error = 1
     pass
 if error:
-    raise RuntimeError, "bad namet typemap"
+    raise RuntimeError("bad namet typemap")
 
 #
 #
 #
 t2 = p.vtest(t)
 if t.var_namet != t2.var_namet:
-    raise RuntimeError, "bad SWIGTYPE* typemap"
+    raise RuntimeError("bad SWIGTYPE* typemap")
 
 
 if cvar.fixsize != "ho\0la\0\0\0":
-    raise RuntimeError, "bad FIXSIZE typemap"
+    raise RuntimeError("bad FIXSIZE typemap")
 
 cvar.fixsize = "ho"
 if cvar.fixsize != "ho\0\0\0\0\0\0":
-    raise RuntimeError, "bad FIXSIZE typemap"
+    raise RuntimeError("bad FIXSIZE typemap")
 
 
 f = Foo(3)
 f1 = fptr_val(f)
 f2 = fptr_ref(f)
 if f1._a != f2._a:
-    raise RuntimeError, "bad const ptr& typemap"
+    raise RuntimeError("bad const ptr& typemap")
 
 
 v = char_foo(1, 3)
 if v != 3:
-    raise RuntimeError, "bad int typemap"
+    raise RuntimeError("bad int typemap")
 
 s = char_foo(1, "hello")
 if s != "hello":
-    raise RuntimeError, "bad char* typemap"
+    raise RuntimeError("bad char* typemap")
 
 
 v = SetPos(1, 3)
 if v != 4:
-    raise RuntimeError, "bad int typemap"
+    raise RuntimeError("bad int typemap")
 
 #
 # Check the bounds for converting various types
@@ -481,7 +473,7 @@
 
 # Make sure Python 2's sys.maxint is the same as the maxlong we calculated
 if sys.version_info[0] <= 2 and maxlong != sys.maxint:
-    raise RuntimeError, "sys.maxint is not the maximum value of a signed long"
+    raise RuntimeError("sys.maxint is not the maximum value of a signed long")
 
 def checkType(t, e, val, delta):
     """t = Test object, e = type name (e.g. ulong), val = max or min allowed value, delta = +1 for max, -1 for min"""
@@ -511,7 +503,7 @@
     except OverflowError:
         pass
     if error:
-        raise RuntimeError, "bad " + e + " typemap"
+        raise RuntimeError("bad " + e + " typemap")
 
 def checkFull(t, e, maxval, minval):
     """Check the maximum and minimum bounds for the type given by e"""
@@ -543,17 +535,17 @@
     if val != prevval:
         # Make sure the most extreme value of this type gives the name of this type
         if t.ovr_str(val) != name:
-            raise RuntimeError, "bad " + name + " typemap"
+            raise RuntimeError("bad " + name + " typemap")
         # Make sure a more extreme value doesn't give the name of this type
         try:
             if t.ovr_str(val + delta) == name:
-                raise RuntimeError, "bad " + name + " typemap"
+                raise RuntimeError("bad " + name + " typemap")
             if val == limit:
                 # Should raise TypeError here since this is the largest integral type
-                raise RuntimeError, "bad " + name + " typemap"
+                raise RuntimeError("bad " + name + " typemap")
         except TypeError:
             if val != limit:
-                raise RuntimeError, "bad " + name + " typemap"
+                raise RuntimeError("bad " + name + " typemap")
 
 # Check that overloading works: uchar > schar > ushort > short > uint > int > ulong > long > ullong > llong
 checkOverload(t, "uchar",  maxuchar,  +1, 0,         maxullong)
@@ -568,22 +560,22 @@
 checkOverload(t, "llong",  minllong,  -1, minlong,   minllong)
 
 # Make sure that large ints can be converted to doubles properly
-if val_double(sys.maxint + 1) != float(sys.maxint + 1):
-    raise RuntimeError, "bad double typemap"
-if val_double(-sys.maxint - 2) != float(-sys.maxint - 2):
-    raise RuntimeError, "bad double typemap"
+if val_double(sys.maxsize + 1) != float(sys.maxsize + 1):
+    raise RuntimeError("bad double typemap")
+if val_double(-sys.maxsize - 2) != float(-sys.maxsize - 2):
+    raise RuntimeError("bad double typemap")
 
 
 # Check the minimum and maximum values that fit in ptrdiff_t and size_t
 def checkType(name, maxfunc, maxval, minfunc, minval, echofunc):
     if maxfunc() != maxval:
-        raise RuntimeError, "bad " + name + " typemap"
+        raise RuntimeError("bad " + name + " typemap")
     if minfunc() != minval:
-        raise RuntimeError, "bad " + name + " typemap"
+        raise RuntimeError("bad " + name + " typemap")
     if echofunc(maxval) != maxval:
-        raise RuntimeError, "bad " + name + " typemap"
+        raise RuntimeError("bad " + name + " typemap")
     if echofunc(minval) != minval:
-        raise RuntimeError, "bad " + name + " typemap"
+        raise RuntimeError("bad " + name + " typemap")
     error = 0
     try:
         echofunc(maxval + 1)
@@ -591,14 +583,14 @@
     except OverflowError:
         pass
     if error == 1:
-        raise RuntimeError, "bad " + name + " typemap"
+        raise RuntimeError("bad " + name + " typemap")
     try:
         echofunc(minval - 1)
         error = 1
     except OverflowError:
         pass
     if error == 1:
-        raise RuntimeError, "bad " + name + " typemap"
+        raise RuntimeError("bad " + name + " typemap")
 
 # sys.maxsize is the largest value supported by Py_ssize_t, which should be the same as ptrdiff_t
 if sys.version_info[0:2] >= (2, 6):
diff --git a/Examples/test-suite/python/python_abstractbase_runme3.py b/Examples/test-suite/python/python_abstractbase_runme.py
similarity index 100%
rename from Examples/test-suite/python/python_abstractbase_runme3.py
rename to Examples/test-suite/python/python_abstractbase_runme.py
diff --git a/Examples/test-suite/python/python_builtin_runme.py b/Examples/test-suite/python/python_builtin_runme.py
index 26e757c..8a42a26 100644
--- a/Examples/test-suite/python/python_builtin_runme.py
+++ b/Examples/test-suite/python/python_builtin_runme.py
@@ -32,7 +32,7 @@
   passed = False
   try:
     h = hash(ExceptionHashFunction())
-  except RuntimeError, e:
+  except RuntimeError as e:
     passed = str(e).find("oops") != -1
     pass
 
diff --git a/Examples/test-suite/python/python_destructor_exception_runme.py b/Examples/test-suite/python/python_destructor_exception_runme.py
index ee71ab3..4765953 100644
--- a/Examples/test-suite/python/python_destructor_exception_runme.py
+++ b/Examples/test-suite/python/python_destructor_exception_runme.py
@@ -1,7 +1,11 @@
 import python_destructor_exception
-from StringIO import StringIO
 import sys
 
+if sys.version_info[0:2] < (3, 0):
+    import StringIO as io
+else:
+    import io
+
 def error_function():
     python_destructor_exception.ClassWithThrowingDestructor().GetBlah()
 
@@ -9,13 +13,13 @@
     attributeErrorOccurred = False
     try:
         error_function()
-    except AttributeError, e:
+    except AttributeError:
         attributeErrorOccurred = True
     return attributeErrorOccurred
 
 def test1():
     stderr_saved = sys.stderr
-    buffer = StringIO()
+    buffer = io.StringIO()
     attributeErrorOccurred = False
     try:
         # Suppress stderr while making this call to suppress the output shown by PyErr_WriteUnraisable
diff --git a/Examples/test-suite/python/python_nondynamic_runme.py b/Examples/test-suite/python/python_nondynamic_runme.py
index fbb60ad..524f4d1 100644
--- a/Examples/test-suite/python/python_nondynamic_runme.py
+++ b/Examples/test-suite/python/python_nondynamic_runme.py
@@ -51,9 +51,7 @@
 
 try:
     bb.c = 3
-    print("bb.c = {}".format(bb.c))
-    print("B.c = {}".format(B.c))
-    raise RuntimeError("B.c class variable messes up nondynamic-ness of B")
+    raise RuntimeError("B.c class variable messes up nondynamic-ness of B bb.c={} B.c={}".format(bb.c, B.c))
 except AttributeError as e:
     debug_print(e)
     pass
@@ -99,9 +97,7 @@
 if not python_nondynamic.is_python_builtin():
     try:
         bb.cc = 3
-        print("bb.cc = {}".format(bb.cc))
-        print("B.cc = {}".format(B.cc))
-        raise RuntimeError("B.cc class variable messes up nondynamic-ness of B")
+        raise RuntimeError("B.cc class variable messes up nondynamic-ness of B bb.cc={} B.cc={}".format(bb.cc, B.cc))
     except AttributeError as e:
         debug_print(e)
         pass
diff --git a/Examples/test-suite/python/python_overload_simple_cast_runme.py b/Examples/test-suite/python/python_overload_simple_cast_runme.py
index d4cb8a3..fc398ab 100644
--- a/Examples/test-suite/python/python_overload_simple_cast_runme.py
+++ b/Examples/test-suite/python/python_overload_simple_cast_runme.py
@@ -30,136 +30,136 @@
     good = 1
 
 if not good:
-    raise RuntimeError, "fint(int)"
+    raise RuntimeError("fint(int)")
 
 
 if fint(ad) != "fint:int":
-    raise RuntimeError, "fint(int)"
+    raise RuntimeError("fint(int)")
 
 if fdouble(ad) != "fdouble:double":
-    raise RuntimeError, "fdouble(double)"
+    raise RuntimeError("fdouble(double)")
 
 if fint(ai) != "fint:int":
-    raise RuntimeError, "fint(int)"
+    raise RuntimeError("fint(int)")
 
 if fint(5.0) != "fint:int":
-    raise RuntimeError, "fint(int)"
+    raise RuntimeError("fint(int)")
 
 if fint(3) != "fint:int":
-    raise RuntimeError, "fint(int)"
+    raise RuntimeError("fint(int)")
 if fint(3.0) != "fint:int":
-    raise RuntimeError, "fint(int)"
+    raise RuntimeError("fint(int)")
 
 if fdouble(ad) != "fdouble:double":
-    raise RuntimeError, "fdouble(double)"
+    raise RuntimeError("fdouble(double)")
 if fdouble(3) != "fdouble:double":
-    raise RuntimeError, "fdouble(double)"
+    raise RuntimeError("fdouble(double)")
 if fdouble(3.0) != "fdouble:double":
-    raise RuntimeError, "fdouble(double)"
+    raise RuntimeError("fdouble(double)")
 
 if fid(3, 3.0) != "fid:intdouble":
-    raise RuntimeError, "fid:intdouble"
+    raise RuntimeError("fid:intdouble")
 
 if fid(3.0, 3) != "fid:doubleint":
-    raise RuntimeError, "fid:doubleint"
+    raise RuntimeError("fid:doubleint")
 
 if fid(ad, ai) != "fid:doubleint":
-    raise RuntimeError, "fid:doubleint"
+    raise RuntimeError("fid:doubleint")
 
 if fid(ai, ad) != "fid:intdouble":
-    raise RuntimeError, "fid:intdouble"
+    raise RuntimeError("fid:intdouble")
 
 
 if foo(3) != "foo:int":
-    raise RuntimeError, "foo(int)"
+    raise RuntimeError("foo(int)")
 
 if foo(3.0) != "foo:double":
-    raise RuntimeError, "foo(double)"
+    raise RuntimeError("foo(double)")
 
 if foo("hello") != "foo:char *":
-    raise RuntimeError, "foo(char *)"
+    raise RuntimeError("foo(char *)")
 
 f = Foo()
 b = Bar()
 
 if foo(f) != "foo:Foo *":
-    raise RuntimeError, "foo(Foo *)"
+    raise RuntimeError("foo(Foo *)")
 
 if foo(b) != "foo:Bar *":
-    raise RuntimeError, "foo(Bar *)"
+    raise RuntimeError("foo(Bar *)")
 
 v = malloc_void(32)
 
 if foo(v) != "foo:void *":
-    raise RuntimeError, "foo(void *)"
+    raise RuntimeError("foo(void *)")
 
 s = Spam()
 
 if s.foo(3) != "foo:int":
-    raise RuntimeError, "Spam::foo(int)"
+    raise RuntimeError("Spam::foo(int)")
 
 if s.foo(3.0) != "foo:double":
-    raise RuntimeError, "Spam::foo(double)"
+    raise RuntimeError("Spam::foo(double)")
 
 if s.foo("hello") != "foo:char *":
-    raise RuntimeError, "Spam::foo(char *)"
+    raise RuntimeError("Spam::foo(char *)")
 
 if s.foo(f) != "foo:Foo *":
-    raise RuntimeError, "Spam::foo(Foo *)"
+    raise RuntimeError("Spam::foo(Foo *)")
 
 if s.foo(b) != "foo:Bar *":
-    raise RuntimeError, "Spam::foo(Bar *)"
+    raise RuntimeError("Spam::foo(Bar *)")
 
 if s.foo(v) != "foo:void *":
-    raise RuntimeError, "Spam::foo(void *)"
+    raise RuntimeError("Spam::foo(void *)")
 
 if Spam_bar(3) != "bar:int":
-    raise RuntimeError, "Spam::bar(int)"
+    raise RuntimeError("Spam::bar(int)")
 
 if Spam_bar(3.0) != "bar:double":
-    raise RuntimeError, "Spam::bar(double)"
+    raise RuntimeError("Spam::bar(double)")
 
 if Spam_bar("hello") != "bar:char *":
-    raise RuntimeError, "Spam::bar(char *)"
+    raise RuntimeError("Spam::bar(char *)")
 
 if Spam_bar(f) != "bar:Foo *":
-    raise RuntimeError, "Spam::bar(Foo *)"
+    raise RuntimeError("Spam::bar(Foo *)")
 
 if Spam_bar(b) != "bar:Bar *":
-    raise RuntimeError, "Spam::bar(Bar *)"
+    raise RuntimeError("Spam::bar(Bar *)")
 
 if Spam_bar(v) != "bar:void *":
-    raise RuntimeError, "Spam::bar(void *)"
+    raise RuntimeError("Spam::bar(void *)")
 
 # Test constructors
 
 s = Spam()
 if s.type != "none":
-    raise RuntimeError, "Spam()"
+    raise RuntimeError("Spam()")
 
 s = Spam(3)
 if s.type != "int":
-    raise RuntimeError, "Spam(int)"
+    raise RuntimeError("Spam(int)")
 
 s = Spam(3.4)
 if s.type != "double":
-    raise RuntimeError, "Spam(double)"
+    raise RuntimeError("Spam(double)")
 
 s = Spam("hello")
 if s.type != "char *":
-    raise RuntimeError, "Spam(char *)"
+    raise RuntimeError("Spam(char *)")
 
 s = Spam(f)
 if s.type != "Foo *":
-    raise RuntimeError, "Spam(Foo *)"
+    raise RuntimeError("Spam(Foo *)")
 
 s = Spam(b)
 if s.type != "Bar *":
-    raise RuntimeError, "Spam(Bar *)"
+    raise RuntimeError("Spam(Bar *)")
 
 s = Spam(v)
 if s.type != "void *":
-    raise RuntimeError, "Spam(void *)"
+    raise RuntimeError("Spam(void *)")
 
 
 # unsigned long long
@@ -168,13 +168,13 @@
 ullmin = 0
 ullmind = 0.0
 if ull(ullmin) != ullmin:
-    raise RuntimeError, "ull(ullmin)"
+    raise RuntimeError("ull(ullmin)")
 if ull(ullmax) != ullmax:
-    raise RuntimeError, "ull(ullmax)"
+    raise RuntimeError("ull(ullmax)")
 if ull(ullmind) != ullmind:
-    raise RuntimeError, "ull(ullmind)"
+    raise RuntimeError("ull(ullmind)")
 if ull(ullmaxd) != ullmaxd:
-    raise RuntimeError, "ull(ullmaxd)"
+    raise RuntimeError("ull(ullmaxd)")
 
 # long long
 llmax = 9223372036854775807  # 0x7fffffffffffffff
@@ -183,13 +183,13 @@
 llmaxd = 9007199254740992.0
 llmind = -9007199254740992.0
 if ll(llmin) != llmin:
-    raise RuntimeError, "ll(llmin)"
+    raise RuntimeError("ll(llmin)")
 if ll(llmax) != llmax:
-    raise RuntimeError, "ll(llmax)"
+    raise RuntimeError("ll(llmax)")
 if ll(llmind) != llmind:
-    raise RuntimeError, "ll(llmind)"
+    raise RuntimeError("ll(llmind)")
 if ll(llmaxd) != llmaxd:
-    raise RuntimeError, "ll(llmaxd)"
+    raise RuntimeError("ll(llmaxd)")
 
 
 free_void(v)
diff --git a/Examples/test-suite/python/python_pickle_runme.py b/Examples/test-suite/python/python_pickle_runme.py
index 27c67ae..cbe425f 100644
--- a/Examples/test-suite/python/python_pickle_runme.py
+++ b/Examples/test-suite/python/python_pickle_runme.py
@@ -15,15 +15,15 @@
 
 r = p.__reduce__()
 if python_pickle.cvar.debug:
-    print "__reduce__ returned:", r
+    print("__reduce__ returned: {}".format(r))
 pickle_string = pickle.dumps(p)
 newp = pickle.loads(pickle_string)
 check(newp)
 
 # Not yet working... some crash and others are not producing a sensible "can't be pickled" error
 #nfp = python_pickle.NotForPickling("no no")
-#print nfp.__reduce__()
+#print("{}".format(nfp.__reduce__()))
 #pickle_string = pickle.dumps(nfp)
-#print pickle_string
+#print("{}".format(pickle_string))
 #newp = pickle.loads(pickle_string)
-#print newp.msg
+#print("{}".format(newp.msg))
diff --git a/Examples/test-suite/python/python_pybuffer_runme.py b/Examples/test-suite/python/python_pybuffer_runme.py
index 8ecdb52..6507920 100644
--- a/Examples/test-suite/python/python_pybuffer_runme.py
+++ b/Examples/test-suite/python/python_pybuffer_runme.py
@@ -17,13 +17,13 @@
     a = bytearray(b"hello world")
     for i in range(k):
         python_pybuffer.title1(a)
-    print "Time used by bytearray:", time.time() - t
+    print("Time used by bytearray: {}".format(time.time() - t))
 
     t = time.time()
     b = "hello world"
     for i in range(k):
         python_pybuffer.title2(b)
-    print "Time used by string:", time.time() - t
+    print("Time used by string: {}".format(time.time() - t))
 else:
     # run the test case
     buf1 = bytearray(10)
@@ -44,3 +44,27 @@
     buf3 = bytearray(b"hello")
     python_pybuffer.title1(buf3)
     check(buf3 == b"Hello")
+
+    try:
+        python_pybuffer.func1(1)
+        raise RuntimeError("should throw TypeError")
+    except TypeError as e:
+        check("(char *buf1, int len)" in str(e))
+
+    try:
+        python_pybuffer.func2(1)
+        raise RuntimeError("should throw TypeError")
+    except TypeError as e:
+        check("(char *buf2)" in str(e))
+
+    try:
+        python_pybuffer.func3(1)
+        raise RuntimeError("should throw TypeError")
+    except TypeError as e:
+        check("(const char *buf3, int len)" in str(e))
+
+    try:
+        python_pybuffer.func4(1)
+        raise RuntimeError("should throw TypeError")
+    except TypeError as e:
+        check("(const char *buf4)" in str(e))
diff --git a/Examples/test-suite/python/python_richcompare_runme.py b/Examples/test-suite/python/python_richcompare_runme.py
index 724d1d7..988a3f9 100644
--- a/Examples/test-suite/python/python_richcompare_runme.py
+++ b/Examples/test-suite/python/python_richcompare_runme.py
@@ -114,22 +114,22 @@
     try:
         res = base1 < 42
         raise RuntimeError("Failed to throw")
-    except TypeError,e:
+    except TypeError as e:
         check_unorderable_types(e)
     try:
         res = base1 <= 42
         raise RuntimeError("Failed to throw")
-    except TypeError,e:
+    except TypeError as e:
         check_unorderable_types(e)
     try:
         res = base1 > 42
         raise RuntimeError("Failed to throw")
-    except TypeError,e:
+    except TypeError as e:
         check_unorderable_types(e)
     try:
         res = base1 >= 42
         raise RuntimeError("Failed to throw")
-    except TypeError,e:
+    except TypeError as e:
         check_unorderable_types(e)
 
 # Check inequalities used for ordering
diff --git a/Examples/test-suite/python/python_strict_unicode_runme.py b/Examples/test-suite/python/python_strict_unicode_runme.py
index e7fae25..79c768d 100644
--- a/Examples/test-suite/python/python_strict_unicode_runme.py
+++ b/Examples/test-suite/python/python_strict_unicode_runme.py
@@ -1,8 +1,20 @@
 import python_strict_unicode
+import sys
 
 test_bytes   = b"hello \x01world\x99"
 BYTES        = b"BYTES"
-test_unicode = u"h\udce9llo w\u00f6rld"
+
+if sys.version_info[0:2] < (3, 0):
+    # Python 3.0-3.2 results in a SyntaxError when using u"" string literals, so we use a
+    # convoluted unicode string construction using unicode() and unichr().
+    # Conventional Python 2 syntax shown in comments.
+    test_unicode = unicode("h" + unichr(0xdce9) + "llo w" + unichr(0x00f6) + "rld") # u"h\udce9llo w\u00f6rld"
+    UNICODE      = unicode("UNICODE")
+    type_unicode_string = type(UNICODE)
+else:
+    test_unicode = "h\udce9llo w\u00f6rld"
+    UNICODE      = "UNICODE"
+    type_unicode_string = type(UNICODE)
 
 # Test that byte string inputs and outputs work as expected
 bdbl = python_strict_unicode.double_str(test_bytes)
@@ -20,12 +32,12 @@
 udbl = python_strict_unicode.double_wstr(test_unicode)
 if udbl != test_unicode + test_unicode:
     raise RuntimeError("Failed to double wide string")
-if type(udbl) != type(u""):
+if type(udbl) != type_unicode_string:
     raise RuntimeError("Wrong type output for wide string")
 uout = python_strict_unicode.same_wstr(test_unicode)
 if uout != test_unicode:
     raise RuntimeError("Failed to copy wchar_t*")
-if type(uout) != type(u""):
+if type(uout) != type_unicode_string:
     raise RuntimeError("Wrong type output for wchar_t*")
 
 # Test that overloading is handled properly
@@ -35,9 +47,9 @@
 if type(bovr) != type(BYTES):
     raise RuntimeError("Wrong type output from overload")
 uovr = python_strict_unicode.overload(test_unicode)
-if uovr != u"UNICODE":
+if uovr != UNICODE:
     raise RuntimeError("Failed to return unicode from overload")
-if type(uovr) != type(u""):
+if type(uovr) != type_unicode_string:
     raise RuntimeERror("Wrong type output from overload")
 
 # Test that bytes aren't accepted as wide strings and unicode isn't accepted as narrow strings
diff --git a/Examples/test-suite/python/return_const_value_runme.py b/Examples/test-suite/python/return_const_value_runme.py
index ff3bd5f..809eed9 100644
--- a/Examples/test-suite/python/return_const_value_runme.py
+++ b/Examples/test-suite/python/return_const_value_runme.py
@@ -3,10 +3,8 @@
 
 p = return_const_value.Foo_ptr_getPtr()
 if (p.getVal() != 17):
-    print "Runtime test1 failed. p.getVal()=", p.getVal()
-    sys.exit(1)
+    raise RuntimeError("Runtime test1 failed. p.getVal()={}".format(p.getVal()))
 
 p = return_const_value.Foo_ptr_getConstPtr()
 if (p.getVal() != 17):
-    print "Runtime test2 failed. p.getVal()=", p.getVal()
-    sys.exit(1)
+    raise RuntimeError("Runtime test2 failed. p.getVal()={}".format(p.getVal()))
diff --git a/Examples/test-suite/python/smart_pointer_member_runme.py b/Examples/test-suite/python/smart_pointer_member_runme.py
index d2ed87e..9758b0b 100644
--- a/Examples/test-suite/python/smart_pointer_member_runme.py
+++ b/Examples/test-suite/python/smart_pointer_member_runme.py
@@ -11,9 +11,7 @@
 b.y = 2
 
 if f.y != 2:
-    print f.y
-    print b.y
-    raise RuntimeError
+    raise RuntimeError("Failed {} {}".format(f.y, b.y))
 
 if b.x != f.x:
     raise RuntimeError
diff --git a/Examples/test-suite/python/smart_pointer_not_runme.py b/Examples/test-suite/python/smart_pointer_not_runme.py
index 69704c4..8cd9f11 100644
--- a/Examples/test-suite/python/smart_pointer_not_runme.py
+++ b/Examples/test-suite/python/smart_pointer_not_runme.py
@@ -7,36 +7,36 @@
 
 try:
     x = b.x
-    print "Error! b.x"
-except:
+    raise RuntimeError("Error! b.x")
+except AttributeError:
     pass
 
 try:
     x = s.x
-    print "Error! s.x"
-except:
+    raise RuntimeError("Error! s.x")
+except AttributeError:
     pass
 
 try:
     x = g.x
-    print "Error! g.x"
-except:
+    raise RuntimeError("Error! g.x")
+except AttributeError:
     pass
 
 try:
     x = b.getx()
-    print "Error! b.getx()"
-except:
+    raise RuntimeError("Error! b.getx()")
+except AttributeError:
     pass
 
 try:
     x = s.getx()
-    print "Error! s.getx()"
-except:
+    raise RuntimeError("Error! s.getx()")
+except AttributeError:
     pass
 
 try:
     x = g.getx()
-    print "Error! g.getx()"
-except:
+    raise RuntimeError("Error! g.getx()")
+except AttributeError:
     pass
diff --git a/Examples/test-suite/python/std_containers_runme.py b/Examples/test-suite/python/std_containers_runme.py
index 7404cd5..820c8f4 100644
--- a/Examples/test-suite/python/std_containers_runme.py
+++ b/Examples/test-suite/python/std_containers_runme.py
@@ -7,34 +7,33 @@
 icube = std_containers.cident(cube)
 for i in range(0, len(cube)):
     if cube[i] != icube[i]:
-        raise RuntimeError, "bad cident"
+        raise RuntimeError("bad cident")
 
 
 p = (1, 2)
 if p != std_containers.pident(p):
-    raise RuntimeError, "bad pident"
+    raise RuntimeError("bad pident")
 
 v = (1, 2, 3, 4, 5, 6)
 iv = std_containers.vident(v)
 for i in range(0, len(v)):
     if v[i] != iv[i]:
-        raise RuntimeError, "bad vident"
+        raise RuntimeError("bad vident")
 
 
 iv = std_containers.videntu(v)
 for i in range(0, len(v)):
     if v[i] != iv[i]:
-        raise RuntimeError, "bad videntu"
+        raise RuntimeError("bad videntu")
 
 
 vu = std_containers.vector_ui(v)
 if vu[2] != std_containers.videntu(vu)[2]:
-    raise RuntimeError, "bad videntu"
+    raise RuntimeError("bad videntu")
 
 
 if v[0:3][1] != vu[0:3][1]:
-    print v[0:3][1], vu[0:3][1]
-    raise RuntimeError, "bad getslice"
+    raise RuntimeError("bad getslice {} {}".format(v[0:3][1], vu[0:3][1]))
 
 
 m = ((1, 2, 3), (2, 3), (3, 4))
@@ -43,20 +42,20 @@
 for i in range(0, len(m)):
     for j in range(0, len(m[i])):
         if m[i][j] != im[i][j]:
-            raise RuntimeError, "bad getslice"
+            raise RuntimeError("bad getslice")
 
 m = ((True, False, True), (True, True), (True, True))
 im = std_containers.midentb(m)
 for i in range(0, len(m)):
     for j in range(0, len(m[i])):
         if m[i][j] != im[i][j]:
-            raise RuntimeError, "bad getslice"
+            raise RuntimeError("bad getslice")
 
 
 mi = std_containers.imatrix(m)
 mc = std_containers.cmatrix(m)
 if mi[0][1] != mc[0][1]:
-    raise RuntimeError, "bad matrix"
+    raise RuntimeError("bad matrix")
 
 
 map = {}
@@ -67,7 +66,7 @@
 imap = std_containers.mapident(map)
 for k in map:
     if map[k] != imap[k]:
-        raise RuntimeError, "bad map"
+        raise RuntimeError("bad map")
 
 # Test __contains__ (required for 'x in y' to work)
 if not imap.__contains__("hello"):
diff --git a/Examples/test-suite/python/struct_value_runme.py b/Examples/test-suite/python/struct_value_runme.py
index aa3ece3..9fe5c81 100644
--- a/Examples/test-suite/python/struct_value_runme.py
+++ b/Examples/test-suite/python/struct_value_runme.py
@@ -17,7 +17,7 @@
 if b.added != 123:
     raise RuntimeError("Wrong attribute value")
 
-if not b.__dict__.has_key("added"):
+if "added" not in b.__dict__:
     raise RuntimeError("Missing added attribute in __dict__")
 
 
@@ -28,7 +28,7 @@
         struct_value.Bar.__init__(self)
 
 pybar = PyBar()
-if not pybar.__dict__.has_key("extra"):
+if "extra" not in pybar.__dict__:
     raise RuntimeError("Missing extra attribute in __dict__")
 if pybar.extra != "hi":
     raise RuntimeError("Incorrect attribute value for extra")
diff --git a/Examples/test-suite/python/swigobject_runme.py b/Examples/test-suite/python/swigobject_runme.py
index de232f5..e28e187 100644
--- a/Examples/test-suite/python/swigobject_runme.py
+++ b/Examples/test-suite/python/swigobject_runme.py
@@ -1,5 +1,5 @@
-
 from swigobject import *
+import sys
 
 a = A()
 
@@ -11,7 +11,11 @@
     raise RuntimeError
 
 
-lthis = long(a.this)
+if sys.version_info[0:2] < (3, 0):
+    lthis = long(a.this)
+else:
+    lthis = int(a.this)
+
 # match pointer value, but deal with leading zeros on 8/16 bit systems and
 # different C++ compilers interpretation of %p
 xstr1 = "%016X" % (lthis,)
@@ -23,13 +27,17 @@
 xstr2 = str.upper(xstr2)
 
 if xstr1 != xstr2:
-    print xstr1, xstr2
-    raise RuntimeError
+    raise RuntimeError("Not equal failed {} {}".format(xstr1, xstr2))
 
 s = str(a.this)
 r = repr(a.this)
 
 v1 = v_ptr(a)
 v2 = v_ptr(a)
-if long(v1) != long(v2):
-    raise RuntimeError
+
+if sys.version_info[0:2] < (3, 0):
+    if long(v1) != long(v2):
+        raise RuntimeError
+else:
+    if int(v1) != int(v2):
+        raise RuntimeError
diff --git a/Examples/test-suite/python/template_classes_runme.py b/Examples/test-suite/python/template_classes_runme.py
index 38b2d7a..1bd1339 100644
--- a/Examples/test-suite/python/template_classes_runme.py
+++ b/Examples/test-suite/python/template_classes_runme.py
@@ -13,7 +13,7 @@
 fail = True
 try:
     rectangle.setPoint()
-except TypeError, e:
+except TypeError as e:
     fail = False
 if fail:
     raise RuntimeError("argument count check failed")
@@ -22,7 +22,7 @@
 fail = True
 try:
     rectangle.getPoint(0)
-except TypeError, e:
+except TypeError as e:
     fail = False
 if fail:
     raise RuntimeError("argument count check failed")
@@ -30,7 +30,7 @@
 fail = True
 try:
     RectangleInt.static_noargs(0)
-except TypeError, e:
+except TypeError as e:
     fail = False
 if fail:
     raise RuntimeError("argument count check failed")
@@ -38,7 +38,7 @@
 fail = True
 try:
     RectangleInt.static_onearg()
-except TypeError, e:
+except TypeError as e:
     fail = False
 if fail:
     raise RuntimeError("argument count check failed")
diff --git a/Examples/test-suite/python/template_default_arg_runme.py b/Examples/test-suite/python/template_default_arg_runme.py
index 91b1e0e..e9ef00f 100644
--- a/Examples/test-suite/python/template_default_arg_runme.py
+++ b/Examples/test-suite/python/template_default_arg_runme.py
@@ -7,25 +7,25 @@
 
 x = template_default_arg.X_int()
 if (x.meth(20.0, 200) != 200):
-    raise RuntimeError, ("X_int test 1 failed")
+    raise RuntimeError(("X_int test 1 failed"))
 if (x.meth(20) != 20):
-    raise RuntimeError, ("X_int test 2 failed")
+    raise RuntimeError(("X_int test 2 failed"))
 if (x.meth() != 0):
-    raise RuntimeError, ("X_int test 3 failed")
+    raise RuntimeError(("X_int test 3 failed"))
 
 
 y = template_default_arg.Y_unsigned()
 if (y.meth(20.0, 200) != 200):
-    raise RuntimeError, ("Y_unsigned test 1 failed")
+    raise RuntimeError(("Y_unsigned test 1 failed"))
 if (y.meth(20) != 20):
-    raise RuntimeError, ("Y_unsigned test 2 failed")
+    raise RuntimeError(("Y_unsigned test 2 failed"))
 if (y.meth() != 0):
-    raise RuntimeError, ("Y_unsigned test 3 failed")
+    raise RuntimeError(("Y_unsigned test 3 failed"))
 
 
 x = template_default_arg.X_longlong()
 x = template_default_arg.X_longlong(20.0)
-x = template_default_arg.X_longlong(20.0, 200L)
+x = template_default_arg.X_longlong(20.0, 200)
 
 
 x = template_default_arg.X_int()
@@ -54,40 +54,40 @@
 
 # plain function: int ott(Foo<int>)
 if (template_default_arg.ott(template_default_arg.Foo_int()) != 30):
-    raise RuntimeError, ("ott test 1 failed")
+    raise RuntimeError(("ott test 1 failed"))
 
 # %template(ott) ott<int, int>
 if (template_default_arg.ott() != 10):
-    raise RuntimeError, ("ott test 2 failed")
+    raise RuntimeError(("ott test 2 failed"))
 if (template_default_arg.ott(1) != 10):
-    raise RuntimeError, ("ott test 3 failed")
+    raise RuntimeError(("ott test 3 failed"))
 if (template_default_arg.ott(1, 1) != 10):
-    raise RuntimeError, ("ott test 4 failed")
+    raise RuntimeError(("ott test 4 failed"))
 
 if (template_default_arg.ott("hi") != 20):
-    raise RuntimeError, ("ott test 5 failed")
+    raise RuntimeError(("ott test 5 failed"))
 if (template_default_arg.ott("hi", 1) != 20):
-    raise RuntimeError, ("ott test 6 failed")
+    raise RuntimeError(("ott test 6 failed"))
 if (template_default_arg.ott("hi", 1, 1) != 20):
-    raise RuntimeError, ("ott test 7 failed")
+    raise RuntimeError(("ott test 7 failed"))
 
 # %template(ott) ott<const char *>
 if (template_default_arg.ottstring(template_default_arg.Hello_int(), "hi") != 40):
-    raise RuntimeError, ("ott test 8 failed")
+    raise RuntimeError(("ott test 8 failed"))
 
 if (template_default_arg.ottstring(template_default_arg.Hello_int()) != 40):
-    raise RuntimeError, ("ott test 9 failed")
+    raise RuntimeError(("ott test 9 failed"))
 
 # %template(ott) ott<int>
 if (template_default_arg.ottint(template_default_arg.Hello_int(), 1) != 50):
-    raise RuntimeError, ("ott test 10 failed")
+    raise RuntimeError(("ott test 10 failed"))
 
 if (template_default_arg.ottint(template_default_arg.Hello_int()) != 50):
-    raise RuntimeError, ("ott test 11 failed")
+    raise RuntimeError(("ott test 11 failed"))
 
 # %template(ott) ott<double>
 if (template_default_arg.ott(template_default_arg.Hello_int(), 1.0) != 60):
-    raise RuntimeError, ("ott test 12 failed")
+    raise RuntimeError(("ott test 12 failed"))
 
 if (template_default_arg.ott(template_default_arg.Hello_int()) != 60):
-    raise RuntimeError, ("ott test 13 failed")
+    raise RuntimeError(("ott test 13 failed"))
diff --git a/Examples/test-suite/python/template_typedef_cplx2_runme.py b/Examples/test-suite/python/template_typedef_cplx2_runme.py
index 161bd51..23f19ef 100644
--- a/Examples/test-suite/python/template_typedef_cplx2_runme.py
+++ b/Examples/test-suite/python/template_typedef_cplx2_runme.py
@@ -8,25 +8,21 @@
     d = make_Identity_double()
     a = d.this
 except:
-    print d, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(d))
 
 s = "%s" % d
 if str.find(s, "ArithUnaryFunction") == -1:
-    print d, "is not an ArithUnaryFunction"
-    raise RuntimeError
+    raise RuntimeError("{} is not an ArithUnaryFunction".format(d))
 
 try:
     e = make_Multiplies_double_double_double_double(d, d)
     a = e.this
 except:
-    print e, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(e))
 
 s = "%s" % e
 if str.find(s, "ArithUnaryFunction") == -1:
-    print e, "is not an ArithUnaryFunction"
-    raise RuntimeError
+    raise RuntimeError("{} is not an ArithUnaryFunction".format(e))
 
 
 #
@@ -37,25 +33,21 @@
     c = make_Identity_complex()
     a = c.this
 except:
-    print c, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(c))
 
 s = "%s" % c
 if str.find(s, "ArithUnaryFunction") == -1:
-    print c, "is not an ArithUnaryFunction"
-    raise RuntimeError
+    raise RuntimeError("{} is not an ArithUnaryFunction".format(c))
 
 try:
     f = make_Multiplies_complex_complex_complex_complex(c, c)
     a = f.this
 except:
-    print f, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(f))
 
 s = "%s" % f
 if str.find(s, "ArithUnaryFunction") == -1:
-    print f, "is not an ArithUnaryFunction"
-    raise RuntimeError
+    raise RuntimeError("{} is not an ArithUnaryFunction".format(f))
 
 #
 # Mix case
@@ -65,29 +57,24 @@
     g = make_Multiplies_double_double_complex_complex(d, c)
     a = g.this
 except:
-    print g, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(g))
 
 s = "%s" % g
 if str.find(s, "ArithUnaryFunction") == -1:
-    print g, "is not an ArithUnaryFunction"
-    raise RuntimeError
+    raise RuntimeError("{} is not an ArithUnaryFunction".format(g))
 
 
 try:
     h = make_Multiplies_complex_complex_double_double(c, d)
     a = h.this
 except:
-    print h, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(h))
 
 s = "%s" % h
 if str.find(s, "ArithUnaryFunction") == -1:
-    print h, "is not an ArithUnaryFunction"
-    raise RuntimeError
+    raise RuntimeError("{} is not an ArithUnaryFunction".format(h))
 
 try:
     a = g.get_value()
 except:
-    print g, "has not get_value() method"
-    raise RuntimeError
+    raise RuntimeError("{}, has not get_value() method".format(g))
diff --git a/Examples/test-suite/python/template_typedef_cplx_runme.py b/Examples/test-suite/python/template_typedef_cplx_runme.py
index 1846739..69d5642 100644
--- a/Examples/test-suite/python/template_typedef_cplx_runme.py
+++ b/Examples/test-suite/python/template_typedef_cplx_runme.py
@@ -8,25 +8,21 @@
     d = make_Identity_double()
     a = d.this
 except:
-    print d, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(d))
 
 s = "%s" % d
 if str.find(s, "ArithUnaryFunction") == -1:
-    print d, "is not an ArithUnaryFunction"
-    raise RuntimeError
+    raise RuntimeError("{} is not an ArithUnaryFunction".format(d))
 
 try:
     e = make_Multiplies_double_double_double_double(d, d)
     a = e.this
 except:
-    print e, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(e))
 
 s = "%s" % e
 if str.find(s, "ArithUnaryFunction") == -1:
-    print e, "is not an ArithUnaryFunction"
-    raise RuntimeError
+    raise RuntimeError("{} is not an ArithUnaryFunction".format(e))
 
 
 #
@@ -37,25 +33,21 @@
     c = make_Identity_complex()
     a = c.this
 except:
-    print c, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(c))
 
 s = "%s" % c
 if str.find(s, "ArithUnaryFunction") == -1:
-    print c, "is not an ArithUnaryFunction"
-    raise RuntimeError
+    raise RuntimeError("{} is not an ArithUnaryFunction".format(c))
 
 try:
     f = make_Multiplies_complex_complex_complex_complex(c, c)
     a = f.this
 except:
-    print f, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(f))
 
 s = "%s" % f
 if str.find(s, "ArithUnaryFunction") == -1:
-    print f, "is not an ArithUnaryFunction"
-    raise RuntimeError
+    raise RuntimeError("{} is not an ArithUnaryFunction".format(f))
 
 #
 # Mix case
@@ -65,23 +57,19 @@
     g = make_Multiplies_double_double_complex_complex(d, c)
     a = g.this
 except:
-    print g, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(g))
 
 s = "%s" % g
 if str.find(s, "ArithUnaryFunction") == -1:
-    print g, "is not an ArithUnaryFunction"
-    raise RuntimeError
+    raise RuntimeError("{} is not an ArithUnaryFunction".format(g))
 
 
 try:
     h = make_Multiplies_complex_complex_double_double(c, d)
     a = h.this
 except:
-    print h, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(h))
 
 s = "%s" % h
 if str.find(s, "ArithUnaryFunction") == -1:
-    print h, "is not an ArithUnaryFunction"
-    raise RuntimeError
+    raise RuntimeError("{} is not an ArithUnaryFunction".format(h))
diff --git a/Examples/test-suite/python/template_typedef_runme.py b/Examples/test-suite/python/template_typedef_runme.py
index 16695ba..5723e4f 100644
--- a/Examples/test-suite/python/template_typedef_runme.py
+++ b/Examples/test-suite/python/template_typedef_runme.py
@@ -14,22 +14,19 @@
     e = make_Multiplies_float_float_float_float(d, d)
     a = e.this
 except:
-    print e, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(e))
 
 try:
     f = make_Multiplies_reald_reald_reald_reald(c, c)
     a = f.this
 except:
-    print f, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(f))
 
 try:
     g = make_Multiplies_float_float_reald_reald(d, c)
     a = g.this
 except:
-    print g, "is not an instance"
-    raise RuntimeError
+    raise RuntimeError("{} is not an instance".format(g))
 
 
 # the old large format
diff --git a/Examples/test-suite/python/template_typemaps_typedef2_runme.py b/Examples/test-suite/python/template_typemaps_typedef2_runme.py
index 258f443..da26a9f 100644
--- a/Examples/test-suite/python/template_typemaps_typedef2_runme.py
+++ b/Examples/test-suite/python/template_typemaps_typedef2_runme.py
@@ -5,7 +5,7 @@
 dummy_pair = m1.make_dummy_pair()
 val = m1.typemap_test(dummy_pair).val
 if val != 1234:
-    raise RuntimeError, "typemaps not working"
+    raise RuntimeError("typemaps not working")
 
 m2 = MultimapAInt()
 
@@ -13,24 +13,24 @@
 #dummy_pair = m2.make_dummy_pair()
 #val = m2.typemap_test(dummy_pair)
 
-# print val
+# print("{}".format(val))
 # if val != 4321:
 #    raise RuntimeError, "typemaps not working"
 
 if typedef_test1(dummy_pair).val != 1234:
-    raise RuntimeError, "typedef_test1 not working"
+    raise RuntimeError("typedef_test1 not working")
 
 if typedef_test2(dummy_pair).val != 1234:
-    raise RuntimeError, "typedef_test2 not working"
+    raise RuntimeError("typedef_test2 not working")
 
 if typedef_test3(dummy_pair).val != 1234:
-    raise RuntimeError, "typedef_test3 not working"
+    raise RuntimeError("typedef_test3 not working")
 
 if typedef_test4(dummy_pair).val != 1234:
-    raise RuntimeError, "typedef_test4 not working"
+    raise RuntimeError("typedef_test4 not working")
 
 if typedef_test5(dummy_pair).val != 1234:
-    raise RuntimeError, "typedef_test5 not working"
+    raise RuntimeError("typedef_test5 not working")
 
 if typedef_test6(dummy_pair).val != 1234:
-    raise RuntimeError, "typedef_test6 not working"
+    raise RuntimeError("typedef_test6 not working")
diff --git a/Examples/test-suite/python/template_typemaps_typedef_runme.py b/Examples/test-suite/python/template_typemaps_typedef_runme.py
index 1ca3f83..a5209b7 100644
--- a/Examples/test-suite/python/template_typemaps_typedef_runme.py
+++ b/Examples/test-suite/python/template_typemaps_typedef_runme.py
@@ -5,7 +5,7 @@
 dummy_pair = m1.make_dummy_pair()
 val = m1.typemap_test(dummy_pair).val
 if val != 1234:
-    raise RuntimeError, "typemaps not working"
+    raise RuntimeError("typemaps not working")
 
 m2 = MultimapAInt()
 
@@ -13,24 +13,24 @@
 #dummy_pair = m2.make_dummy_pair()
 #val = m2.typemap_test(dummy_pair)
 
-# print val
+# print("{}".format(val))
 # if val != 4321:
 #    raise RuntimeError, "typemaps not working"
 
 if typedef_test1(dummy_pair).val != 1234:
-    raise RuntimeError, "typedef_test1 not working"
+    raise RuntimeError("typedef_test1 not working")
 
 if typedef_test2(dummy_pair).val != 1234:
-    raise RuntimeError, "typedef_test2 not working"
+    raise RuntimeError("typedef_test2 not working")
 
 if typedef_test3(dummy_pair).val != 1234:
-    raise RuntimeError, "typedef_test3 not working"
+    raise RuntimeError("typedef_test3 not working")
 
 if typedef_test4(dummy_pair).val != 1234:
-    raise RuntimeError, "typedef_test4 not working"
+    raise RuntimeError("typedef_test4 not working")
 
 if typedef_test5(dummy_pair).val != 1234:
-    raise RuntimeError, "typedef_test5 not working"
+    raise RuntimeError("typedef_test5 not working")
 
 if typedef_test6(dummy_pair).val != 1234:
-    raise RuntimeError, "typedef_test6 not working"
+    raise RuntimeError("typedef_test6 not working")
diff --git a/Examples/test-suite/python/threads_exception_runme.py b/Examples/test-suite/python/threads_exception_runme.py
index 056bd84..e3f6299 100644
--- a/Examples/test-suite/python/threads_exception_runme.py
+++ b/Examples/test-suite/python/threads_exception_runme.py
@@ -3,18 +3,18 @@
 t = threads_exception.Test()
 try:
     t.unknown()
-except RuntimeError, e:
+except RuntimeError as e:
     pass
 
 try:
     t.simple()
-except RuntimeError, e:
+except RuntimeError as e:
     if e.args[0] != 37:
         raise RuntimeError
 
 try:
     t.message()
-except RuntimeError, e:
+except RuntimeError as e:
     if e.args[0] != "I died.":
         raise RuntimeError
 
@@ -23,18 +23,18 @@
 if not threads_exception.is_python_builtin():
     try:
         t.hosed()
-    except threads_exception.Exc, e:
+    except threads_exception.Exc as e:
         code = e.code
         if code != 42:
-            raise RuntimeError, "bad... code: %d" % code
+            raise RuntimeError("bad... code: %d" % code)
         msg = e.msg
         if msg != "Hosed":
-            raise RuntimeError, "bad... msg: '%s' len: %d" % (msg, len(msg))
+            raise RuntimeError("bad... msg: '%s' len: %d" % (msg, len(msg)))
 
 for i in range(1, 4):
     try:
         t.multi(i)
-    except RuntimeError, e:
+    except RuntimeError as e:
         pass
-    except threads_exception.Exc, e:
+    except threads_exception.Exc as e:
         pass
diff --git a/Examples/test-suite/python/typedef_inherit_runme.py b/Examples/test-suite/python/typedef_inherit_runme.py
index 6b7f2d8..3c552ec 100644
--- a/Examples/test-suite/python/typedef_inherit_runme.py
+++ b/Examples/test-suite/python/typedef_inherit_runme.py
@@ -5,19 +5,19 @@
 
 x = typedef_inherit.do_blah(a)
 if x != "Foo::blah":
-    print "Whoa! Bad return", x
+    raise RuntimeError("Whoa! Bad return {}".format(x))
 
 x = typedef_inherit.do_blah(b)
 if x != "Bar::blah":
-    print "Whoa! Bad return", x
+    raise RuntimeError("Whoa! Bad return {}".format(x))
 
 c = typedef_inherit.Spam()
 d = typedef_inherit.Grok()
 
 x = typedef_inherit.do_blah2(c)
 if x != "Spam::blah":
-    print "Whoa! Bad return", x
+    raise RuntimeError("Whoa! Bad return {}".format(x))
 
 x = typedef_inherit.do_blah2(d)
 if x != "Grok::blah":
-    print "Whoa! Bad return", x
+    raise RuntimeError("Whoa! Bad return {}".format(x))
diff --git a/Examples/test-suite/python/typedef_scope_runme.py b/Examples/test-suite/python/typedef_scope_runme.py
index edd3e9f..0294c4a 100644
--- a/Examples/test-suite/python/typedef_scope_runme.py
+++ b/Examples/test-suite/python/typedef_scope_runme.py
@@ -3,8 +3,8 @@
 b = typedef_scope.Bar()
 x = b.test1(42, "hello")
 if x != 42:
-    print "Failed!!"
+    raise RuntimeError("Failed!!")
 
 x = b.test2(42, "hello")
 if x != "hello":
-    print "Failed!!"
+    raise RuntimeError("Failed!!")
diff --git a/Examples/test-suite/python/typemap_arrays_runme.py b/Examples/test-suite/python/typemap_arrays_runme.py
index ea0f08d..7bc45f9 100644
--- a/Examples/test-suite/python/typemap_arrays_runme.py
+++ b/Examples/test-suite/python/typemap_arrays_runme.py
@@ -1,4 +1,4 @@
 from typemap_arrays import *
 
 if sumA(None) != 60:
-    raise RuntimeError, "Sum is wrong"
+    raise RuntimeError("Sum is wrong")
diff --git a/Examples/test-suite/python/typename_runme.py b/Examples/test-suite/python/typename_runme.py
index aac936f..a4f76fc 100644
--- a/Examples/test-suite/python/typename_runme.py
+++ b/Examples/test-suite/python/typename_runme.py
@@ -4,8 +4,8 @@
 b = typename.Bar()
 
 x = typename.twoFoo(f)
-if not isinstance(x, types.FloatType):
-    raise RuntimeError, "Wrong return type (FloatType) !"
+if not isinstance(x, float):
+    raise RuntimeError("Wrong return type (FloatType) !")
 y = typename.twoBar(b)
-if not isinstance(y, types.IntType):
-    raise RuntimeError, "Wrong return type (IntType)!"
+if not isinstance(y, int):
+    raise RuntimeError("Wrong return type (IntType)!")
diff --git a/Examples/test-suite/python/unicode_strings_runme.py b/Examples/test-suite/python/unicode_strings_runme.py
index 4e661f0..57bd7ab 100644
--- a/Examples/test-suite/python/unicode_strings_runme.py
+++ b/Examples/test-suite/python/unicode_strings_runme.py
@@ -2,12 +2,8 @@
 
 import unicode_strings
 
-# The 'u' string prefix isn't valid in Python 3.0 - 3.2 and is redundant
-# in 3.3+. Since this file is run through 2to3 before testing, though,
-# mark this as a unicode string in 2.x so it'll become a str in 3.x.
-test_string = u"h\udce9llo w\u00f6rld"
-
 if sys.version_info[0:2] >= (3, 1):
+    test_string = "h\udce9llo w\u00f6rld"
     if unicode_strings.non_utf8_c_str() != test_string:
         raise ValueError("Test comparison mismatch")
     if unicode_strings.non_utf8_std_string() != test_string:
@@ -19,19 +15,24 @@
 
 # Testing SWIG_PYTHON_2_UNICODE flag which allows unicode strings to be passed to C
 if sys.version_info[0:2] < (3, 0):
+    # Python 3.0-3.2 results in a SyntaxError when using u"" string literals, so we use a
+    # convoluted unicode string construction using unicode() and unichr().
+    # Conventional Python 2 syntax shown in comments.
     check(unicode_strings.charstring("hello1"), "hello1")
-    check(unicode_strings.charstring(str(u"hello2")), "hello2")
-    check(unicode_strings.charstring(u"hello3"), "hello3")
-    check(unicode_strings.charstring(unicode("hello4")), "hello4")
-    unicode_strings.charstring(u"hell\xb05")
-    unicode_strings.charstring(u"hell\u00f66")
-
-low_surrogate_string = u"\udcff"
-try:
+    check(unicode_strings.charstring(str(unicode("hello2"))), "hello2") # u"hello2"
+    check(unicode_strings.charstring(unicode("hello3")), "hello3") # u"hello3"
+    check(unicode_strings.charstring(str("hello4")), "hello4")
+    unicode_strings.charstring(unicode("hell" + unichr(0xb0) + "5")) # u"hell\xb05"
+    unicode_strings.charstring(unicode("hell" + unichr(0x00f6) +"6")) # u"hell\u00f66"
+    low_surrogate_string = unichr(0xdcff) # u"\udcff"
     unicode_strings.instring(low_surrogate_string)
-    # Will succeed with Python 2
-except TypeError, e:
-    # Python 3 will fail the PyUnicode_AsUTF8String conversion resulting in a TypeError.
-    # The real error is actually:
-    # UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 0: surrogates not allowed
-    pass
+else:
+    low_surrogate_string = "\udcff"
+    try:
+        unicode_strings.instring(low_surrogate_string)
+        raise RuntimeError("Exception should have been thrown")
+    except TypeError as e:
+        # Python 3 will fail the PyUnicode_AsUTF8String conversion resulting in a TypeError.
+        # The real error is actually:
+        # UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 0: surrogates not allowed
+        pass
diff --git a/Examples/test-suite/python/unions_runme.py b/Examples/test-suite/python/unions_runme.py
index 387a048..5a3ee3b 100644
--- a/Examples/test-suite/python/unions_runme.py
+++ b/Examples/test-suite/python/unions_runme.py
@@ -3,7 +3,6 @@
 # union embedded within a struct can be set and read correctly.
 
 import unions
-import sys
 import string
 
 # Create new instances of SmallStruct and BigStruct for later use
@@ -23,28 +22,23 @@
 eut.uni.small = small
 Jill1 = eut.uni.small.jill
 if (Jill1 != 200):
-    print "Runtime test1 failed. eut.uni.small.jill=", Jill1
-    sys.exit(1)
+    raise RuntimeError("Runtime test1 failed. eut.uni.small.jill={}".format(Jill1))
 
 Num1 = eut.number
 if (Num1 != 1):
-    print "Runtime test2 failed. eut.number=", Num1
-    sys.exit(1)
+    raise RuntimeError("Runtime test2 failed. eut.number=".format(Num1))
 
 # Secondly check the BigStruct in EmbeddedUnionTest
 eut.number = 2
 eut.uni.big = big
 Jack1 = eut.uni.big.jack
 if (Jack1 != 300):
-    print "Runtime test3 failed. eut.uni.big.jack=", Jack1
-    sys.exit(1)
+    raise RuntimeError("Runtime test3 failed. eut.uni.big.jack={}".format(Jack1))
 
 Jill2 = eut.uni.big.smallstruct.jill
 if (Jill2 != 200):
-    print "Runtime test4 failed. eut.uni.big.smallstruct.jill=", Jill2
-    sys.exit(1)
+    raise RuntimeError("Runtime test4 failed. eut.uni.big.smallstruct.jill={}".format(Jill2))
 
 Num2 = eut.number
 if (Num2 != 2):
-    print "Runtime test5 failed. eut.number=", Num2
-    sys.exit(1)
+    raise RuntimeError("Runtime test5 failed. eut.number={}".format(Num2))
diff --git a/Examples/test-suite/python/using_composition_runme.py b/Examples/test-suite/python/using_composition_runme.py
index c4f3390..67f72bc 100644
--- a/Examples/test-suite/python/using_composition_runme.py
+++ b/Examples/test-suite/python/using_composition_runme.py
@@ -2,32 +2,32 @@
 
 f = FooBar()
 if f.blah(3) != 3:
-    raise RuntimeError, "FooBar::blah(int)"
+    raise RuntimeError("FooBar::blah(int)")
 
 if f.blah(3.5) != 3.5:
-    raise RuntimeError, "FooBar::blah(double)"
+    raise RuntimeError("FooBar::blah(double)")
 
 if f.blah("hello") != "hello":
-    raise RuntimeError, "FooBar::blah(char *)"
+    raise RuntimeError("FooBar::blah(char *)")
 
 
 f = FooBar2()
 if f.blah(3) != 3:
-    raise RuntimeError, "FooBar2::blah(int)"
+    raise RuntimeError("FooBar2::blah(int)")
 
 if f.blah(3.5) != 3.5:
-    raise RuntimeError, "FooBar2::blah(double)"
+    raise RuntimeError("FooBar2::blah(double)")
 
 if f.blah("hello") != "hello":
-    raise RuntimeError, "FooBar2::blah(char *)"
+    raise RuntimeError("FooBar2::blah(char *)")
 
 
 f = FooBar3()
 if f.blah(3) != 3:
-    raise RuntimeError, "FooBar3::blah(int)"
+    raise RuntimeError("FooBar3::blah(int)")
 
 if f.blah(3.5) != 3.5:
-    raise RuntimeError, "FooBar3::blah(double)"
+    raise RuntimeError("FooBar3::blah(double)")
 
 if f.blah("hello") != "hello":
-    raise RuntimeError, "FooBar3::blah(char *)"
+    raise RuntimeError("FooBar3::blah(char *)")
diff --git a/Examples/test-suite/python/using_extend_runme.py b/Examples/test-suite/python/using_extend_runme.py
index 038a168..7e09129 100644
--- a/Examples/test-suite/python/using_extend_runme.py
+++ b/Examples/test-suite/python/using_extend_runme.py
@@ -2,20 +2,20 @@
 
 f = FooBar()
 if f.blah(3) != 3:
-    raise RuntimeError, "blah(int)"
+    raise RuntimeError("blah(int)")
 
 if f.blah(3.5) != 3.5:
-    raise RuntimeError, "blah(double)"
+    raise RuntimeError("blah(double)")
 
 if f.blah("hello") != "hello":
-    raise RuntimeError, "blah(char *)"
+    raise RuntimeError("blah(char *)")
 
 if f.blah(3, 4) != 7:
-    raise RuntimeError, "blah(int,int)"
+    raise RuntimeError("blah(int,int)")
 
 if f.blah(3.5, 7.5) != (3.5 + 7.5):
-    raise RuntimeError, "blah(double,double)"
+    raise RuntimeError("blah(double,double)")
 
 
 if f.duh(3) != 3:
-    raise RuntimeError, "duh(int)"
+    raise RuntimeError("duh(int)")
diff --git a/Examples/test-suite/python/using_inherit_runme.py b/Examples/test-suite/python/using_inherit_runme.py
index 4fd5959..ccdeece 100644
--- a/Examples/test-suite/python/using_inherit_runme.py
+++ b/Examples/test-suite/python/using_inherit_runme.py
@@ -2,47 +2,47 @@
 
 b = Bar()
 if b.test(3) != 3:
-    raise RuntimeError, "Bar::test(int)"
+    raise RuntimeError("Bar::test(int)")
 
 if b.test(3.5) != 3.5:
-    raise RuntimeError, "Bar::test(double)"
+    raise RuntimeError("Bar::test(double)")
 
 
 b = Bar2()
 if b.test(3) != 6:
-    raise RuntimeError, "Bar2::test(int)"
+    raise RuntimeError("Bar2::test(int)")
 
 if b.test(3.5) != 7.0:
-    raise RuntimeError, "Bar2::test(double)"
+    raise RuntimeError("Bar2::test(double)")
 
 
 b = Bar3()
 if b.test(3) != 6:
-    raise RuntimeError, "Bar3::test(int)"
+    raise RuntimeError("Bar3::test(int)")
 
 if b.test(3.5) != 7.0:
-    raise RuntimeError, "Bar3::test(double)"
+    raise RuntimeError("Bar3::test(double)")
 
 
 b = Bar4()
 if b.test(3) != 6:
-    raise RuntimeError, "Bar4::test(int)"
+    raise RuntimeError("Bar4::test(int)")
 
 if b.test(3.5) != 7.0:
-    raise RuntimeError, "Bar4::test(double)"
+    raise RuntimeError("Bar4::test(double)")
 
 
 b = Fred1()
 if b.test(3) != 3:
-    raise RuntimeError, "Fred1::test(int)"
+    raise RuntimeError("Fred1::test(int)")
 
 if b.test(3.5) != 7.0:
-    raise RuntimeError, "Fred1::test(double)"
+    raise RuntimeError("Fred1::test(double)")
 
 
 b = Fred2()
 if b.test(3) != 3:
-    raise RuntimeError, "Fred2::test(int)"
+    raise RuntimeError("Fred2::test(int)")
 
 if b.test(3.5) != 7.0:
-    raise RuntimeError, "Fred2::test(double)"
+    raise RuntimeError("Fred2::test(double)")
diff --git a/Examples/test-suite/python/using_private_runme.py b/Examples/test-suite/python/using_private_runme.py
index 00c9a8d..9e0a15f 100644
--- a/Examples/test-suite/python/using_private_runme.py
+++ b/Examples/test-suite/python/using_private_runme.py
@@ -4,10 +4,10 @@
 f.x = 3
 
 if f.blah(4) != 4:
-    raise RuntimeError, "blah(int)"
+    raise RuntimeError("blah(int)")
 
 if f.defaulted() != -1:
-    raise RuntimeError, "defaulted()"
+    raise RuntimeError("defaulted()")
 
 if f.defaulted(222) != 222:
-    raise RuntimeError, "defaulted(222)"
+    raise RuntimeError("defaulted(222)")
diff --git a/Examples/test-suite/python/using_protected_runme.py b/Examples/test-suite/python/using_protected_runme.py
index 525a1cd..dd47723 100644
--- a/Examples/test-suite/python/using_protected_runme.py
+++ b/Examples/test-suite/python/using_protected_runme.py
@@ -4,4 +4,4 @@
 f.x = 3
 
 if f.blah(4) != 4:
-    raise RuntimeError, "blah(int)"
+    raise RuntimeError("blah(int)")
diff --git a/Examples/test-suite/python/varargs_overload_runme.py b/Examples/test-suite/python/varargs_overload_runme.py
index 6f5a702..ffa7634 100644
--- a/Examples/test-suite/python/varargs_overload_runme.py
+++ b/Examples/test-suite/python/varargs_overload_runme.py
@@ -1,62 +1,62 @@
 import varargs_overload
 
 if varargs_overload.vararg_over1("Hello") != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs_overload.vararg_over1(2) != "2":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 
 if varargs_overload.vararg_over2("Hello") != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs_overload.vararg_over2(2, 2.2) != "2 2.2":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 
 if varargs_overload.vararg_over3("Hello") != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs_overload.vararg_over3(2, 2.2, "hey") != "2 2.2 hey":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs_overload.vararg_over4("Hello") != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs_overload.vararg_over4(123) != "123":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs_overload.vararg_over4("Hello", 123) != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 
 # Same as above but non-vararg function declared first
 
 if varargs_overload.vararg_over6("Hello") != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs_overload.vararg_over6(2) != "2":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 
 if varargs_overload.vararg_over7("Hello") != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs_overload.vararg_over7(2, 2.2) != "2 2.2":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 
 if varargs_overload.vararg_over8("Hello") != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs_overload.vararg_over8(2, 2.2, "hey") != "2 2.2 hey":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs_overload.vararg_over9("Hello") != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs_overload.vararg_over9(123) != "123":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs_overload.vararg_over9("Hello", 123) != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
diff --git a/Examples/test-suite/python/varargs_runme.py b/Examples/test-suite/python/varargs_runme.py
index 277ea75..8f90d5c 100644
--- a/Examples/test-suite/python/varargs_runme.py
+++ b/Examples/test-suite/python/varargs_runme.py
@@ -1,31 +1,31 @@
 import varargs
 
 if varargs.test("Hello") != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 f = varargs.Foo("Greetings")
 if f.str != "Greetings":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if f.test("Hello") != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 
 if varargs.test_def("Hello", 1) != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs.test_def("Hello") != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 ###
 if varargs.test_plenty("Hello") != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs.test_plenty("Hello", 1) != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 if varargs.test_plenty("Hello", 1, 2) != "Hello":
-    raise RuntimeError, "Failed"
+    raise RuntimeError("Failed")
 
 try:
     varargs.test_plenty("Hello", 1, 2, 3)
diff --git a/Examples/test-suite/python/virtual_derivation_runme.py b/Examples/test-suite/python/virtual_derivation_runme.py
index 68546c6..21014bd 100644
--- a/Examples/test-suite/python/virtual_derivation_runme.py
+++ b/Examples/test-suite/python/virtual_derivation_runme.py
@@ -4,4 +4,4 @@
 #
 b = B(3)
 if b.get_a() != b.get_b():
-    raise RuntimeError, "something is really wrong"
+    raise RuntimeError("something is really wrong")
diff --git a/Examples/test-suite/ruby/li_std_wstring_runme.rb b/Examples/test-suite/ruby/li_std_wstring_runme.rb
index 4922d8d..170f80e 100644
--- a/Examples/test-suite/ruby/li_std_wstring_runme.rb
+++ b/Examples/test-suite/ruby/li_std_wstring_runme.rb
@@ -50,3 +50,10 @@
 swig_assert_equal("Li_std_wstring.test_value(x)", "x", binding)
 swig_assert_equal("Li_std_wstring.test_ccvalue(x)", '"abc"', binding)
 swig_assert_equal("Li_std_wstring.test_wchar_overload(x)", '"abc"', binding)
+
+ts = Li_std_wstring::Wchar_test_struct.new
+ts.wchar_t_member = h
+swig_assert_equal("ts.wchar_t_member", "h", binding)
+ts.wchar_t_ptr_member = s
+swig_assert_equal("ts.wchar_t_ptr_member", "s", binding)
+
diff --git a/Lib/csharp/csharp.swg b/Lib/csharp/csharp.swg
index 8322063..0e180f5 100644
--- a/Lib/csharp/csharp.swg
+++ b/Lib/csharp/csharp.swg
@@ -875,6 +875,15 @@
     global::System.IntPtr ret = $imcall;$excode
     return ret;
   }
+%typemap(csvarin, excode=SWIGEXCODE2) void *VOID_INT_PTR %{
+    set {
+      $imcall;$excode
+    } %}
+%typemap(csvarout, excode=SWIGEXCODE2) void *VOID_INT_PTR %{
+    get {
+      global::System.IntPtr ret = $imcall;$excode
+      return ret;
+    } %}
 %typemap(csdirectorin) void *VOID_INT_PTR "$iminput"
 %typemap(csdirectorout) void *VOID_INT_PTR "$cscall"
 
@@ -885,6 +894,7 @@
 %typemap(csinterfaces)                SWIGTYPE "global::System.IDisposable"
 %typemap(csinterfaces)                          SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
 %typemap(csinterfaces_derived)        SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
+%typemap(csinterfacemodifiers)        SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public interface"
 
 
 // csbody typemaps... these are in macros so that the visibility of the methods can be easily changed by users.
diff --git a/Lib/csharp/wchar.i b/Lib/csharp/wchar.i
index 7981941..1ece767 100644
--- a/Lib/csharp/wchar.i
+++ b/Lib/csharp/wchar.i
@@ -92,7 +92,7 @@
     } %}
 %typemap(csvarout, excode=SWIGEXCODE2) wchar_t * %{
     get {
-      string ret = $imcall;$excode
+      string ret = global::System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode
       return ret;
     } %}
 
diff --git a/Lib/java/director.swg b/Lib/java/director.swg
index d3bd162..e911a3d 100644
--- a/Lib/java/director.swg
+++ b/Lib/java/director.swg
@@ -215,6 +215,15 @@
       }
     };
 
+    struct SwigDirectorMethod {
+      const char *name;
+      const char *desc;
+      jmethodID methid;
+      SwigDirectorMethod(JNIEnv *jenv, jclass baseclass, const char *name, const char *desc) : name(name), desc(desc) {
+        methid = jenv->GetMethodID(baseclass, name, desc);
+      }
+    };
+
     /* Java object wrapper */
     JObjectWrapper swig_self_;
 
@@ -238,6 +247,11 @@
       }
     }
 
+    jclass swig_new_global_ref(JNIEnv *jenv, const char *classname) {
+      jclass clz = jenv->FindClass(classname);
+      return clz ? (jclass)jenv->NewGlobalRef(clz) : 0;
+    }
+
   public:
     Director(JNIEnv *jenv) : swig_jvm_((JavaVM *) NULL), swig_self_() {
       /* Acquire the Java VM pointer */
diff --git a/Lib/java/java.swg b/Lib/java/java.swg
index e930933..8f95f3a 100644
--- a/Lib/java/java.swg
+++ b/Lib/java/java.swg
@@ -1196,6 +1196,7 @@
 %typemap(javacode)             SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
 %typemap(javaimports)          SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
 %typemap(javainterfaces)       SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
+%typemap(javainterfacemodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [], SWIGTYPE (CLASS::*) "public interface"
 
 /* javabody typemaps */
 
diff --git a/Lib/python/builtin.swg b/Lib/python/builtin.swg
index 5308748..4f31a8d 100644
--- a/Lib/python/builtin.swg
+++ b/Lib/python/builtin.swg
@@ -414,11 +414,7 @@
 SWIGINTERN void
 SwigPyBuiltin_SetMetaType (PyTypeObject *type, PyTypeObject *metatype)
 {
-#if PY_VERSION_HEX >= 0x03000000
-    type->ob_base.ob_base.ob_type = metatype;
-#else
-    type->ob_type = metatype;
-#endif
+    Py_TYPE(type) = metatype;
 }
 
 
diff --git a/Lib/python/pybuffer.i b/Lib/python/pybuffer.i
index 577eb69..2fdaa6d 100644
--- a/Lib/python/pybuffer.i
+++ b/Lib/python/pybuffer.i
@@ -17,13 +17,13 @@
   int res; Py_ssize_t size = 0; void *buf = 0;
   Py_buffer view;
   res = PyObject_GetBuffer($input, &view, PyBUF_WRITABLE);
-  size = view.len;
-  buf = view.buf;
-  PyBuffer_Release(&view);
   if (res < 0) {
     PyErr_Clear();
     %argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum);
   }
+  size = view.len;
+  buf = view.buf;
+  PyBuffer_Release(&view);
   $1 = ($1_ltype) buf;
   $2 = ($2_ltype) (size/sizeof($*1_type));
 }
@@ -47,12 +47,12 @@
   int res; void *buf = 0;
   Py_buffer view;
   res = PyObject_GetBuffer($input, &view, PyBUF_WRITABLE);
-  buf = view.buf;
-  PyBuffer_Release(&view);
   if (res < 0) {
     PyErr_Clear();
     %argument_fail(res, "(TYPEMAP)", $symname, $argnum);
   }
+  buf = view.buf;
+  PyBuffer_Release(&view);
   $1 = ($1_ltype) buf;
 }
 %enddef
@@ -76,13 +76,13 @@
   int res; Py_ssize_t size = 0; const void *buf = 0;
   Py_buffer view;
   res = PyObject_GetBuffer($input, &view, PyBUF_CONTIG_RO);
-  size = view.len;
-  buf = view.buf;
-  PyBuffer_Release(&view);
   if (res < 0) {
     PyErr_Clear();
     %argument_fail(res, "(TYPEMAP, SIZE)", $symname, $argnum);
   }
+  size = view.len;
+  buf = view.buf;
+  PyBuffer_Release(&view);
   $1 = ($1_ltype) buf;
   $2 = ($2_ltype) (size / sizeof($*1_type));
 }
@@ -108,14 +108,12 @@
   int res; const void *buf = 0;
   Py_buffer view;
   res = PyObject_GetBuffer($input, &view, PyBUF_CONTIG_RO);
-  buf = view.buf;
-  PyBuffer_Release(&view);
   if (res < 0) {
+    PyErr_Clear();
     %argument_fail(res, "(TYPEMAP)", $symname, $argnum);
   }
+  buf = view.buf;
+  PyBuffer_Release(&view);
   $1 = ($1_ltype) buf;
 }
 %enddef
-
-
-
diff --git a/Lib/python/pythreads.swg b/Lib/python/pythreads.swg
index d8797e6..8d6c5ab 100644
--- a/Lib/python/pythreads.swg
+++ b/Lib/python/pythreads.swg
@@ -8,8 +8,12 @@
 #    define SWIG_PYTHON_USE_GIL
 #  endif
 #  if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
-#    ifndef SWIG_PYTHON_INITIALIZE_THREADS
-#     define SWIG_PYTHON_INITIALIZE_THREADS  PyEval_InitThreads() 
+#    if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
+#      if PY_VERSION_HEX < 0x03070000
+#        define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
+#      else
+#        define SWIG_PYTHON_INITIALIZE_THREADS
+#      endif
 #    endif
 #    ifdef __cplusplus /* C++ code */
        class SWIG_Python_Thread_Block {
diff --git a/Source/DOH/string.c b/Source/DOH/string.c
index 3689f4f..093330b 100644
--- a/Source/DOH/string.c
+++ b/Source/DOH/string.c
@@ -836,7 +836,9 @@
 	  memmove(t, s, (str->str + str->len) - s + 1);
 	}
       } else {
-	t += (c - s);
+	if (c) {
+	  t += (c - s);
+	}
       }
       s = c;
       ic--;
diff --git a/Source/Include/swigwarn.h b/Source/Include/swigwarn.h
index a08693a..8362cc0 100644
--- a/Source/Include/swigwarn.h
+++ b/Source/Include/swigwarn.h
@@ -277,6 +277,7 @@
 #define WARN_JAVA_TYPEMAP_DIRECTORIN_NODESC   824
 #define WARN_JAVA_NO_DIRECTORCONNECT_ATTR     825
 #define WARN_JAVA_NSPACE_WITHOUT_PACKAGE      826
+#define WARN_JAVA_TYPEMAP_INTERFACEMODIFIERS_UNDEF 847
 
 /* please leave 810-829 free for Java */
 
@@ -297,6 +298,7 @@
 #define WARN_CSHARP_EXCODE                    844
 #define WARN_CSHARP_CANTHROW                  845
 #define WARN_CSHARP_NO_DIRECTORCONNECT_ATTR   846
+#define WARN_CSHARP_TYPEMAP_INTERFACEMODIFIERS_UNDEF 847
 
 /* please leave 830-849 free for C# */
 
diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx
index 27cc65b..5fef4ca 100644
--- a/Source/Modules/csharp.cxx
+++ b/Source/Modules/csharp.cxx
@@ -2050,7 +2050,8 @@
 
   void emitInterfaceDeclaration(Node *n, String *interface_name, File *f_interface) {
     Printv(f_interface, typemapLookup(n, "csimports", Getattr(n, "classtypeobj"), WARN_NONE), "\n", NIL);
-    Printf(f_interface, "public interface %s", interface_name);
+    Printv(f_interface, typemapLookup(n, "csinterfacemodifiers", Getattr(n, "classtypeobj"), WARN_CSHARP_TYPEMAP_INTERFACEMODIFIERS_UNDEF), NIL);
+    Printf(f_interface, " %s", interface_name);
     if (List *baselist = Getattr(n, "bases")) {
       String *bases = 0;
       for (Iterator base = First(baselist); base.item; base = Next(base)) {
diff --git a/Source/Modules/directors.cxx b/Source/Modules/directors.cxx
index 3504b2c..1969747 100644
--- a/Source/Modules/directors.cxx
+++ b/Source/Modules/directors.cxx
@@ -160,7 +160,7 @@
     SwigType *rettype_stripped = SwigType_strip_qualifiers(rettype);
     String *rtype = SwigType_str(rettype, 0);
     Append(result, rtype);
-    if (SwigType_issimple(rettype_stripped) && return_base_type)
+    if ((SwigType_issimple(rettype_stripped) && return_base_type) || SwigType_isqualifier(rettype))
       Append(result, " ");
     Delete(rtype);
     Delete(rettype_stripped);
diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx
index 7734c64..7c8bed4 100644
--- a/Source/Modules/java.cxx
+++ b/Source/Modules/java.cxx
@@ -2145,7 +2145,8 @@
     }
 
     Printv(f_interface, typemapLookup(n, "javaimports", Getattr(n, "classtypeobj"), WARN_NONE), "\n", NIL);
-    Printf(f_interface, "public interface %s", interface_name);
+    Printv(f_interface, typemapLookup(n, "javainterfacemodifiers", Getattr(n, "classtypeobj"), WARN_JAVA_TYPEMAP_INTERFACEMODIFIERS_UNDEF), NIL);
+    Printf(f_interface, " %s", interface_name);
     if (List *baselist = Getattr(n, "bases")) {
       String *bases = 0;
       for (Iterator base = First(baselist); base.item; base = Next(base)) {
@@ -4835,34 +4836,27 @@
     // .'s to delimit namespaces, so we need to replace those with /'s
     Replace(internal_classname, NSPACE_SEPARATOR, "/", DOH_REPLACE_ANY);
 
-    Wrapper_add_localv(w, "baseclass", "static jclass baseclass", "= 0", NIL);
     Printf(w->def, "void %s::swig_connect_director(JNIEnv *jenv, jobject jself, jclass jcls, bool swig_mem_own, bool weak_global) {", director_classname);
 
+    Printf(w->def, "static jclass baseclass = swig_new_global_ref(jenv, \"%s\");\n", internal_classname);
+    Printf(w->def, "if (!baseclass) return;\n");
+
     if (first_class_dmethod != curr_class_dmethod) {
-      Printf(w->def, "static struct {\n");
-      Printf(w->def, "const char *mname;\n");
-      Printf(w->def, "const char *mdesc;\n");
-      Printf(w->def, "jmethodID base_methid;\n");
-      Printf(w->def, "} methods[] = {\n");
+      Printf(w->def, "static SwigDirectorMethod methods[] = {\n");
 
       for (int i = first_class_dmethod; i < curr_class_dmethod; ++i) {
 	UpcallData *udata = Getitem(dmethods_seq, i);
 
-	Printf(w->def, "{ \"%s\", \"%s\", NULL }", Getattr(udata, "method"), Getattr(udata, "fdesc"));
+	Printf(w->def, "SwigDirectorMethod(jenv, baseclass, \"%s\", \"%s\")", Getattr(udata, "method"), Getattr(udata, "fdesc"));
 	if (i != curr_class_dmethod - 1)
 	  Putc(',', w->def);
 	Putc('\n', w->def);
       }
 
-      Printf(w->def, "};\n");
+      Printf(w->def, "};");
     }
 
     Printf(w->code, "if (swig_set_self(jenv, jself, swig_mem_own, weak_global)) {\n");
-    Printf(w->code, "if (!baseclass) {\n");
-    Printf(w->code, "baseclass = jenv->FindClass(\"%s\");\n", internal_classname);
-    Printf(w->code, "if (!baseclass) return;\n");
-    Printf(w->code, "baseclass = (jclass) jenv->NewGlobalRef(baseclass);\n");
-    Printf(w->code, "}\n");
 
     int n_methods = curr_class_dmethod - first_class_dmethod;
 
@@ -4877,12 +4871,8 @@
 
       /* Emit the code to look up the class's methods, initialize the override array */
 
-      Printf(w->code, "bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);\n");
-      Printf(w->code, "for (int i = 0; i < %d; ++i) {\n", n_methods);
-      Printf(w->code, "  if (!methods[i].base_methid) {\n");
-      Printf(w->code, "    methods[i].base_methid = jenv->GetMethodID(baseclass, methods[i].mname, methods[i].mdesc);\n");
-      Printf(w->code, "    if (!methods[i].base_methid) return;\n");
-      Printf(w->code, "  }\n");
+      Printf(w->code, "  bool derived = (jenv->IsSameObject(baseclass, jcls) ? false : true);\n");
+      Printf(w->code, "  for (int i = 0; i < %d; ++i) {\n", n_methods);
       // Generally, derived classes have a mix of overridden and
       // non-overridden methods and it is worth making a GetMethodID
       // check during initialization to determine if each method is
@@ -4902,8 +4892,8 @@
       } else {
         Printf(w->code, "  swig_override[i] = false;\n");
         Printf(w->code, "  if (derived) {\n");
-        Printf(w->code, "    jmethodID methid = jenv->GetMethodID(jcls, methods[i].mname, methods[i].mdesc);\n");
-        Printf(w->code, "    swig_override[i] = (methid != methods[i].base_methid);\n");
+        Printf(w->code, "    jmethodID methid = jenv->GetMethodID(jcls, methods[i].name, methods[i].desc);\n");
+        Printf(w->code, "    swig_override[i] = methods[i].methid && (methid != methods[i].methid);\n");
         Printf(w->code, "    jenv->ExceptionClear();\n");
         Printf(w->code, "  }\n");
       }
diff --git a/Source/Modules/javascript.cxx b/Source/Modules/javascript.cxx
index d2b33b1..98f6d80 100644
--- a/Source/Modules/javascript.cxx
+++ b/Source/Modules/javascript.cxx
@@ -1575,7 +1575,8 @@
       Printf(arg, "argv[%d]", i);
       break;
     default:
-      throw "Illegal state.";
+      Printf(stderr, "Illegal MarshallingMode.");
+      SWIG_exit(EXIT_FAILURE);
     }
     tm = emitInputTypemap(n, p, wrapper, arg);
     Delete(arg);
@@ -2212,7 +2213,8 @@
       Printf(arg, "args[%d]", i);
       break;
     default:
-      throw "Illegal state.";
+      Printf(stderr, "Illegal MarshallingMode.");
+      SWIG_exit(EXIT_FAILURE);
     }
 
     tm = emitInputTypemap(n, p, wrapper, arg);
diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx
index c8c45df..b437d2f 100644
--- a/Source/Modules/python.cxx
+++ b/Source/Modules/python.cxx
@@ -4308,6 +4308,10 @@
     // struct _dictkeysobject *ht_cached_keys;
     printSlot(f, getSlot(n, "feature:python:ht_cached_keys"), "ht_cached_keys");
     Printv(f, "#endif\n", NIL);
+
+    Printv(f, "#if PY_VERSION_HEX >= 0x03090000\n", NIL);
+    printSlot(f, getSlot(n, "feature:python:ht_module"), "ht_module", "PyObject *");
+    Printv(f, "#endif\n", NIL);
     Printf(f, "};\n\n");
 
     String *clientdata = NewString("");
diff --git a/Source/Swig/naming.c b/Source/Swig/naming.c
index 6689ceb..1d78e7a 100644
--- a/Source/Swig/naming.c
+++ b/Source/Swig/naming.c
@@ -1132,6 +1132,7 @@
   Swig_error("SWIG", Getline(n),
              "PCRE regex matching is not available in this SWIG build.\n");
   SWIG_exit(EXIT_FAILURE);
+  return 0;
 }
 
 #endif /* HAVE_PCRE/!HAVE_PCRE */
diff --git a/configure.ac b/configure.ac
index 726a3ba..af4c894 100644
--- a/configure.ac
+++ b/configure.ac
@@ -919,30 +919,6 @@
   fi
 fi
 
-AC_ARG_WITH(2to3, AS_HELP_STRING([--with-2to3=path], [Set location of Python 2to3 tool]), [PY2TO3BIN="$withval"], [PY2TO3BIN="yes"])
-if test -n "$PYTHON3"; then
-  if test "x$PY2TO3BIN" = xyes; then
-    py3to2=`echo $PYTHON3 | sed -e "s/python/2to3-/"`
-    AC_CHECK_PROGS(PY2TO3, $py3to2 2to3)
-    if test -z "$PY2TO3"; then
-      # Windows distributions don't always have the 2to3 executable
-      AC_MSG_CHECKING(for 2to3.py)
-      py2to3script="$PY3PREFIX/Tools/scripts/2to3.py"
-      if test -f "$py2to3script"; then
-        AC_MSG_RESULT($py2to3script)
-        PY2TO3="$PYTHON3 $py2to3script"
-      else
-        AC_MSG_RESULT(Not found)
-      fi
-    fi
-  else
-    PY2TO3="$PY2TO3BIN"
-  fi
-  if test -z "$PY2TO3"; then
-    PYTHON3=
-  fi
-fi
-
 #----------------------------------------------------------------
 # Look for Perl5
 #----------------------------------------------------------------