[Debian-astro-commits] [gyoto] 191/221: Python: make swig file a little less dependent on python

Thibaut Jean-Claude Paumard thibaut at moszumanska.debian.org
Fri May 22 20:52:45 UTC 2015


This is an automated email from the git hooks/post-receive script.

thibaut pushed a commit to branch master
in repository gyoto.

commit 8f8a3aa5a61663848e19b8067b574a222fba52f0
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date:   Tue Jan 13 13:16:44 2015 +0100

    Python: make swig file a little less dependent on python
---
 python/gyoto.i | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/python/gyoto.i b/python/gyoto.i
index c6cb4d5..8a24a84 100644
--- a/python/gyoto.i
+++ b/python/gyoto.i
@@ -19,7 +19,7 @@
 
 /*
     This is a Swig interface file. It is currently meant to provide
-    Python bindings only, but it should ne be too difficult to provide
+    Python bindings only, but it should not be too difficult to provide
     bindings for java, Tcl or whatever other language Swig supports.
  */
 
@@ -186,8 +186,6 @@ GyotoSmPtrClassDerivedHdr(nspace, klass, Gyoto ## klass ## .h)
 // Include any file that is needed to compile the wrappers
 %{
 #define SWIG_FILE_WITH_INIT
-  //#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
-#include "Python.h"
 #define GYOTO_NO_DEPRECATED
 #include "GyotoConfig.h"
 #include "GyotoDefs.h"
@@ -297,15 +295,16 @@ ExtendArrayNumPy(array_size_t, size_t);
 // Expose the Gyoto::Error class
 %include "GyotoError.h"
 
-// Catch all Gyoto errors and re-throw them as a Python run-time error
+// Catch all Gyoto errors and re-throw them as run-time errors for the
+// target language
 %exception {
-	try {
-	$function
-	}
-	catch (Gyoto::Error e) {
-		PyErr_SetString(PyExc_RuntimeError, e);
-		return NULL;
-	}
+  try {
+    $action
+  }
+  catch (Gyoto::Error e) {
+    SWIG_Error(SWIG_RuntimeError, e);
+    SWIG_fail;
+  }
 }
 
 %ignore Gyoto::SmartPointer::operator();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/gyoto.git



More information about the Debian-astro-commits mailing list