From b2bc763bba5890fbd1164cc8c76e930e530b1230 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Wed, 3 Oct 2018 16:03:28 +0200 Subject: [PATCH] Improvement on porting SWIG to python3. --- src/Python/libBatch_Swig_typemap.i | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/src/Python/libBatch_Swig_typemap.i b/src/Python/libBatch_Swig_typemap.i index 5e23259..35701eb 100644 --- a/src/Python/libBatch_Swig_typemap.i +++ b/src/Python/libBatch_Swig_typemap.i @@ -43,21 +43,6 @@ # %typemap(in) SWIGTYPE ; %{ -static std::string pystr2stdstr(PyObject * val) -{ - std::string str_val; - if (PyUnicode_Check(val)) - { - PyObject * temp_bytes = PyUnicode_AsEncodedString(val, "UTF-8", "strict"); - if (temp_bytes != NULL) - { - str_val = PyBytes_AS_STRING(temp_bytes); - Py_DECREF(temp_bytes); - } - } - return str_val; -} - // Helper function to initialize a Batch::Versatile from a PyObj static bool initVersatile(Batch::Versatile & newVersatile, PyObject * input) { @@ -65,13 +50,13 @@ static bool initVersatile(Batch::Versatile & newVersatile, PyObject * input) for (Py_ssize_t i=0; i