Salome HOME
Fixing wrong merge.
[tools/medcoupling.git] / src / ParaMEDMEM_Swig / ParaMEDMEM.typemap
index 89819e4a5fcbfa63dd3d384f6f6f25ebed4c784e..fa2a0ed98e312e5a855998368be84d836b5e5b89 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
   char** aStrs = (char **) malloc((aSize+1)*sizeof(char *));
   for (i = 0; i < aSize; i++) {
     PyObject *s = PyList_GetItem($input,i);
-    if (!PyString_Check(s)) {
+    if (PyString_Check(s))
+      aStrs[i] = PyString_AsString(s);
+%#if PY_VERSION_HEX >= 0x03000000
+    else if (PyUnicode_Check(s))
+      aStrs[i] = PyUnicode_AsUTF8(s);
+%#endif
+    else {
         free(aStrs);
         PyErr_SetString(PyExc_ValueError, "List items must be strings");
         return NULL;
     }
-    aStrs[i] = PyString_AsString(s);
   }
   aStrs[i] = 0;
   $2 = &aStrs;