Salome HOME
For python 3.7 V9_4_0b1
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Wed, 16 Oct 2019 11:04:59 +0000 (13:04 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Wed, 16 Oct 2019 11:17:15 +0000 (13:17 +0200)
src/runtime/TypeConversions.cxx
src/yacsloader/Test/YacsLoaderTest.cxx

index 43589cf350485356a387a5015779fe91f0fadfc0..9f2c738ee8a1ff972dec643b042dbbb29ef433f4 100644 (file)
@@ -742,7 +742,7 @@ namespace YACS
           if (PyUnicode_Check(o))
             {
               Py_ssize_t size;
-              char *ptr = PyUnicode_AsUTF8AndSize(o, &size);
+              const char *ptr = PyUnicode_AsUTF8AndSize(o, &size);
               if (!ptr)
                 throw YACS::ENGINE::ConversionException("Conversion from PyUnicode to string failed");
               s.assign(ptr, size);
@@ -793,7 +793,7 @@ namespace YACS
               // the objref is used by Python as a string (prefix:value) keep it as a string
               Py_ssize_t size;
               std::string s;
-              char *ptr = PyUnicode_AsUTF8AndSize(o, &size);
+              const char *ptr = (char*) PyUnicode_AsUTF8AndSize(o, &size);
               if (!ptr)
                 throw YACS::ENGINE::ConversionException("Conversion from PyUnicode to string failed");
               s.assign(ptr, size);
@@ -846,7 +846,7 @@ namespace YACS
                 }
               Py_ssize_t size;
               std::string mystr;
-              char *ptr = PyUnicode_AsUTF8AndSize(pystring, &size);
+              const char *ptr = (char*) PyUnicode_AsUTF8AndSize(pystring, &size);
               if (!ptr)
                 throw YACS::ENGINE::ConversionException("Conversion from PyUnicode to string failed");
               mystr.assign(ptr, size);
@@ -2315,7 +2315,7 @@ namespace YACS
        s=PyObject_ASCII(ob); // escape non ASCII characters and like repr(), which is not the same as str()...
       }
       Py_ssize_t size;
-      char* characters=PyUnicode_AsUTF8AndSize(s, &size);
+      const char* characters =  PyUnicode_AsUTF8AndSize(s, &size);
       std::string ss( characters, size);
       Py_DECREF(s);
       PyGILState_Release(gstate);
index eca557c894ea553f322ca65c5d3ff091628f1121..8bc41779a484ef58900ac119db42e9285b8f105b 100644 (file)
@@ -252,7 +252,7 @@ void YacsLoaderTest::eschema()
   if (p)
     {
       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-      char *text = PyUnicode_AsUTF8(data);
+      const char *text = PyUnicode_AsUTF8(data);
       CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text));
       delete p;
     }
@@ -268,7 +268,7 @@ void YacsLoaderTest::fschema()
   if (p)
     {
       PyObject *data = ((OutputPyPort*)p->nodeMap["node2"]->getOutputPort("p1"))->get();
-      char *text = PyUnicode_AsUTF8(data);
+      const char *text = PyUnicode_AsUTF8(data);
       CPPUNIT_ASSERT_EQUAL(string("coucoucoucoucoucoucoucou"), string(text) );
       delete p;
     }