From 4058ada173f6e868e70a667078f5a770ae8efa7c Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Wed, 25 Sep 2019 17:26:36 +0200 Subject: Fixed Python bug related to invalid return parameters, fixes #550 --- python/modules/IcePy/ObjectAdapter.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'python/modules/IcePy/ObjectAdapter.cpp') diff --git a/python/modules/IcePy/ObjectAdapter.cpp b/python/modules/IcePy/ObjectAdapter.cpp index 03e6167182a..166ba647a53 100644 --- a/python/modules/IcePy/ObjectAdapter.cpp +++ b/python/modules/IcePy/ObjectAdapter.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -177,7 +178,11 @@ IcePy::ServantLocatorWrapper::locate(const Ice::Current& current, Ice::LocalObje { if(PyTuple_GET_SIZE(res.get()) > 2) { - PyErr_WarnEx(PyExc_RuntimeWarning, STRCAST("invalid return value for ServantLocator::locate"), 1); + const Ice::CommunicatorPtr com = current.adapter->getCommunicator(); + if(com->getProperties()->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) + { + com->getLogger()->warning("invalid return value for ServantLocator::locate"); + } return 0; } servantObj = PyTuple_GET_ITEM(res.get(), 0); @@ -196,7 +201,11 @@ IcePy::ServantLocatorWrapper::locate(const Ice::Current& current, Ice::LocalObje // if(!PyObject_IsInstance(servantObj, _objectType)) { - PyErr_WarnEx(PyExc_RuntimeWarning, STRCAST("return value of ServantLocator::locate is not an Ice object"), 1); + const Ice::CommunicatorPtr com = current.adapter->getCommunicator(); + if(com->getProperties()->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0) + { + com->getLogger()->warning("return value of ServantLocator::locate is not an Ice object"); + } return 0; } -- cgit v1.2.3