diff options
author | Mark Spruiell <mes@zeroc.com> | 2008-07-07 10:33:01 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2008-07-07 10:33:01 -0700 |
commit | 75c6c89ea21f0cd8aa56fc9fed08516ec2117e7f (patch) | |
tree | 2d70eda988f37ebbad94f9cb607274f69ca33630 /py | |
parent | Another version with Mumble (diff) | |
download | ice-75c6c89ea21f0cd8aa56fc9fed08516ec2117e7f.tar.bz2 ice-75c6c89ea21f0cd8aa56fc9fed08516ec2117e7f.tar.xz ice-75c6c89ea21f0cd8aa56fc9fed08516ec2117e7f.zip |
fixing python bugs in stringToProxy/propertyToProxy
Diffstat (limited to 'py')
-rw-r--r-- | py/modules/IcePy/Communicator.cpp | 14 | ||||
-rw-r--r-- | py/modules/IcePy/Proxy.cpp | 2 | ||||
-rw-r--r-- | py/test/Ice/proxy/AllTests.py | 9 |
3 files changed, 23 insertions, 2 deletions
diff --git a/py/modules/IcePy/Communicator.cpp b/py/modules/IcePy/Communicator.cpp index a8267dae0a0..de20c929783 100644 --- a/py/modules/IcePy/Communicator.cpp +++ b/py/modules/IcePy/Communicator.cpp @@ -453,6 +453,10 @@ communicatorStringToProxy(CommunicatorObject* self, PyObject* args) try { proxy = (*self->communicator)->stringToProxy(str); + if(proxy) + { + return createProxy(proxy, *self->communicator); + } } catch(const Ice::Exception& ex) { @@ -460,7 +464,8 @@ communicatorStringToProxy(CommunicatorObject* self, PyObject* args) return 0; } - return createProxy(proxy, *self->communicator); + Py_INCREF(Py_None); + return Py_None; } #ifdef WIN32 @@ -515,6 +520,10 @@ communicatorPropertyToProxy(CommunicatorObject* self, PyObject* args) try { proxy = (*self->communicator)->propertyToProxy(str); + if(proxy) + { + return createProxy(proxy, *self->communicator); + } } catch(const Ice::Exception& ex) { @@ -522,7 +531,8 @@ communicatorPropertyToProxy(CommunicatorObject* self, PyObject* args) return 0; } - return createProxy(proxy, *self->communicator); + Py_INCREF(Py_None); + return Py_None; } #ifdef WIN32 diff --git a/py/modules/IcePy/Proxy.cpp b/py/modules/IcePy/Proxy.cpp index 451ed2ab2b2..678f2709e75 100644 --- a/py/modules/IcePy/Proxy.cpp +++ b/py/modules/IcePy/Proxy.cpp @@ -2152,6 +2152,8 @@ IcePy::initProxy(PyObject* module) PyObject* IcePy::createProxy(const Ice::ObjectPrx& proxy, const Ice::CommunicatorPtr& communicator, PyObject* type) { + assert(proxy); + if(!type) { PyTypeObject* proxyType = &ProxyType; // Necessary to prevent GCC's strict-alias warnings. diff --git a/py/test/Ice/proxy/AllTests.py b/py/test/Ice/proxy/AllTests.py index 6bbd93beec1..0d64e6da8ba 100644 --- a/py/test/Ice/proxy/AllTests.py +++ b/py/test/Ice/proxy/AllTests.py @@ -15,6 +15,15 @@ def test(b): def allTests(communicator, collocated): print "testing stringToProxy...", + + # + # Test nil proxies. + # + p = communicator.stringToProxy('') + test(p == None) + p = communicator.propertyToProxy('bogus') + test(p == None) + ref = "test:default -p 12010 -t 10000" base = communicator.stringToProxy(ref) test(base) |