diff options
author | Mark Spruiell <mes@zeroc.com> | 2017-03-08 15:47:34 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2017-03-08 15:47:34 -0800 |
commit | fc32c2a7805365e7f40ab8a664f94efae35137da (patch) | |
tree | 9004df864027bfef52218772e88357e01d9bdf0c /python/modules/IcePy/Dispatcher.cpp | |
parent | Refreshed Ice::optional (diff) | |
download | ice-fc32c2a7805365e7f40ab8a664f94efae35137da.tar.bz2 ice-fc32c2a7805365e7f40ab8a664f94efae35137da.tar.xz ice-fc32c2a7805365e7f40ab8a664f94efae35137da.zip |
- ICE-6845 - More dispatcher fixes for Python
- Deprecated the InitializationData.threadHook member
- Added threadStart and threadStop members to InitializationData
- InitializationData.batchRequestInterceptor can now be a callable
Diffstat (limited to 'python/modules/IcePy/Dispatcher.cpp')
-rw-r--r-- | python/modules/IcePy/Dispatcher.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/python/modules/IcePy/Dispatcher.cpp b/python/modules/IcePy/Dispatcher.cpp index 70f53e0535c..012d709ef1d 100644 --- a/python/modules/IcePy/Dispatcher.cpp +++ b/python/modules/IcePy/Dispatcher.cpp @@ -45,10 +45,9 @@ extern "C" static PyObject* dispatcherCallInvoke(DispatcherCallObject* self, PyObject* /*args*/, PyObject* /*kwds*/) { - AllowThreads allowThreads; // Release Python's global interpreter lock during blocking calls. - try { + AllowThreads allowThreads; // Release Python's global interpreter lock during blocking calls. (*self->call)->run(); } catch(const Ice::Exception& ex) @@ -131,6 +130,11 @@ IcePy::initDispatcher(PyObject* module) IcePy::Dispatcher::Dispatcher(PyObject* dispatcher) : _dispatcher(dispatcher) { + if(!PyCallable_Check(dispatcher)) + { + throw Ice::InitializationException(__FILE__, __LINE__, "dispatcher must be a callable"); + } + Py_INCREF(dispatcher); } @@ -154,7 +158,7 @@ IcePy::Dispatcher::dispatch(const Ice::DispatcherCallPtr& call, const Ice::Conne obj->call = new Ice::DispatcherCallPtr(call); PyObjectHandle c = createConnection(con, _communicator); - PyObjectHandle tmp = PyObject_CallMethod(_dispatcher.get(), STRCAST("dispatch"), STRCAST("OO"), obj, c.get()); + PyObjectHandle tmp = PyObject_CallFunction(_dispatcher.get(), STRCAST("OO"), obj, c.get()); Py_DECREF(reinterpret_cast<PyObject*>(obj)); if(!tmp.get()) { |