(This change requires SWIG 2.0.x for a bug fix involving interaction between thread mode and exceptions in SWIG).