Salome HOME
Final cleanup
[tools/medcoupling.git] / src / ParaMEDMEM_Swig / ParaMEDMEM.typemap
old mode 100755 (executable)
new mode 100644 (file)
index 835475b..fa2a0ed
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  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
   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;