changeset 193:28173dc00d51

Add catch for value_convert_exception and a test. (fixes issue #16) * pycall.cc: Add a new catch clause. Apparantly this exception thrown from octave_to_python.cc was not handled. Add a test to verify.
author Abhinav Tripathi <genuinelucifer@gmail.com>
date Sat, 25 Jun 2016 06:38:18 -0700
parents ac377ace2ee4
children d2385636bae5
files pycall.cc
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pycall.cc	Thu Jun 09 14:52:06 2016 -0700
+++ b/pycall.cc	Sat Jun 25 06:38:18 2016 -0700
@@ -161,6 +161,10 @@
     {
       error ("pycall: error in return value type conversion");
     }
+  catch (pytave::value_convert_exception const &)
+    {
+      error ("pycall: error in parameter type conversion");
+    }
   catch (error_already_set const &)
     {
       PyObject *ptype, *pvalue, *ptraceback;
@@ -201,6 +205,10 @@
 %!assert (pycall ("typename", "Hello world"), "str")
 %!assert (pycall ("typename", char ([1, 2, 3])), "str")
 
+%!error <parameter type conversion>
+%! pyexec ("def intwrapper(x):\n    return int(x)\n");
+%! pycall ("intwrapper", ftp ());
+
 %!test
 %! pyexec ("def pyfunc(x):\n    return 2*x");
 %! z = pycall ("pyfunc", [20 20]);