From fa8d1af7b9d1d250864a4d9724e3d098132e868b Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Wed, 4 Oct 2017 15:12:21 +0200 Subject: [PATCH] Fix type mapping for Python boolean parameters --- src/Python/libBatch_Swig_typemap.i | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Python/libBatch_Swig_typemap.i b/src/Python/libBatch_Swig_typemap.i index ca73e44..cbd1a23 100644 --- a/src/Python/libBatch_Swig_typemap.i +++ b/src/Python/libBatch_Swig_typemap.i @@ -68,10 +68,10 @@ static bool initVersatile(Batch::Versatile & newVersatile, PyObject * input) } else if (PyString_Check(input)) { // c'est une string newVersatile = PyString_AsString(input); - } else if (PyInt_Check(input)) { // c'est un int - newVersatile = PyInt_AsLong(input); } else if (PyBool_Check(input)) { // c'est un bool newVersatile = (input == Py_True); + } else if (PyInt_Check(input)) { // c'est un int + newVersatile = PyInt_AsLong(input); } else { // erreur PyErr_SetString(PyExc_RuntimeWarning, "initVersatile : invalid PyObject"); return false; -- 2.39.2