-#include "NeutralPythonConv.hxx"
#include "TypeConversions.hxx"
+#include "NeutralPythonConv.hxx"
#include "RuntimeSALOME.hxx"
#include <iostream>
*/
void NeutralPyDouble::put(YACS::ENGINE::Any *data) throw(ConversionException)
{
- double d = data->getDoubleValue();
- PyObject *ob=PyFloat_FromDouble(d);
+ InterpreterUnlocker loc;
+ PyObject* ob=convertNeutralPyObject(edGetType(),data);
DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
_port->put(ob);
Py_DECREF(ob);
- DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
}
*/
void NeutralPyInt::put(YACS::ENGINE::Any *data) throw(ConversionException)
{
- int l = data->getIntValue();
- PyObject *ob=PyLong_FromLong(l);
+ InterpreterUnlocker loc;
+ PyObject* ob=convertNeutralPyObject(edGetType(),data);
DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
_port->put(ob);
Py_DECREF(ob);
- DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
}
void NeutralPyString::put(const void *data) throw(ConversionException)
*/
void NeutralPyString::put(YACS::ENGINE::Any *data) throw(ConversionException)
{
- string val=data->getStringValue();
- PyObject *ob=PyString_FromString(val.c_str());
+ InterpreterUnlocker loc;
+ PyObject* ob=convertNeutralPyObject(edGetType(),data);
DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
_port->put(ob);
Py_DECREF(ob);
- DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
}
void NeutralPyBool::put(const void *data) throw(ConversionException)
*/
void NeutralPyBool::put(YACS::ENGINE::Any *data) throw(ConversionException)
{
- int l = data->getBoolValue();
- PyObject *ob=PyLong_FromLong(l);
+ InterpreterUnlocker loc;
+ PyObject* ob=convertNeutralPyObject(edGetType(),data);
DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
_port->put(ob);
Py_DECREF(ob);
- DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
}
void NeutralPyObjref::put(const void *data) throw(ConversionException)
*/
void NeutralPyObjref::put(YACS::ENGINE::Any *data) throw(ConversionException)
{
- PyObject *ob;
- {
- InterpreterUnlocker loc;
- ob=convertNeutralPyObject(edGetType(),data);
- }
+ InterpreterUnlocker loc;
+ PyObject* ob=convertNeutralPyObject(edGetType(),data);
DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
_port->put(ob);
Py_DECREF(ob);
void NeutralPySequence::put(YACS::ENGINE::Any *data) throw(ConversionException)
{
DEBTRACE( "--------NeutralPySequence::put" );
- PyObject *ob;
- {
InterpreterUnlocker loc;
- ob=convertNeutralPyObject(edGetType(),data);
+ PyObject* ob=convertNeutralPyObject(edGetType(),data);
DEBTRACE( "ob refcnt: " << ob->ob_refcnt );
#ifdef _DEVDEBUG_
cerr << "Sequence= ";
PyObject_Print(ob,stderr,Py_PRINT_RAW);
cerr << endl;
#endif
- }
_port->put(ob);
Py_DECREF(ob);
DEBTRACE( "ob refcnt: " << ob->ob_refcnt );