changeset 230:262832ae684f

pycall: fix test failure with Python 2 * pycall.cc: Fix test failure when running against Python 2.
author Mike Miller <mtmiller@octave.org>
date Wed, 20 Jul 2016 12:52:38 -0700
parents d51b3d120c85
children c02f0a4c92e7
files pycall.cc
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pycall.cc	Wed Jul 20 12:36:47 2016 -0700
+++ b/pycall.cc	Wed Jul 20 12:52:38 2016 -0700
@@ -211,7 +211,11 @@
 
 ## Test argument type conversion of values into Python
 %!test
-%! pyexec ("def typename(x): return type(x).__name__");
+%! pyexec (["def typename(x):\n" ...
+%!          "    s = type(x).__name__\n" ...
+%!          "    if s == 'long':\n" ...
+%!          "        return 'int'\n" ...
+%!          "    return s"]);
 %!assert (pycall ("typename", 0), "float")
 %!assert (pycall ("typename", pi), "float")
 %!assert (pycall ("typename", 2j), "complex")