Salome HOME
Still a problem with forward
[modules/yacs.git] / src / runtime / PythonPorts.cxx
index 7bf134113a95c4b9a461e8f1af22966449ef5aef..f9a218a5979f99dbdd31208774e8fae2f0d8027c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2006-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
@@ -190,6 +190,21 @@ std::string InputPyPort::getAsString()
   return ret;
 }
 
+std::string InputPyPort::getHumanRepr()
+{
+  if(!_data)
+    return dump();
+  PyObject *ret(PyObject_Str(_data));
+  if(!ret)
+    return dump();
+  std::string retCpp;
+  char *val(PyString_AsString(ret));
+  if(val)
+    retCpp=val;
+  Py_XDECREF(ret);
+  return retCpp;
+}
+
 bool InputPyPort::isEmpty()
 {
   return _data == Py_None;
@@ -283,6 +298,7 @@ OutputPyPort::~OutputPyPort()
 OutputPyPort::OutputPyPort(const OutputPyPort& other, Node *newHelder):OutputPort(other,newHelder),DataPort(other,newHelder),Port(other,newHelder),
                                                                        _data(Py_None)
 {
+  Py_INCREF(_data);
 }
 
 void OutputPyPort::put(const void *data) throw(ConversionException)