[110180] trunk/dports/python/py-zeroc-ice35/files/patch-ice.py.modules. IcePy.Communicator.cpp.diff

blair at macports.org blair at macports.org
Tue Aug 27 22:19:47 PDT 2013


Revision: 110180
          https://trac.macports.org/changeset/110180
Author:   blair at macports.org
Date:     2013-08-27 22:19:47 -0700 (Tue, 27 Aug 2013)
Log Message:
-----------
py-zeroc-ice35: follow up to r110167: add new patch file.

Revision Links:
--------------
    https://trac.macports.org/changeset/110167

Added Paths:
-----------
    trunk/dports/python/py-zeroc-ice35/files/patch-ice.py.modules.IcePy.Communicator.cpp.diff

Added: trunk/dports/python/py-zeroc-ice35/files/patch-ice.py.modules.IcePy.Communicator.cpp.diff
===================================================================
--- trunk/dports/python/py-zeroc-ice35/files/patch-ice.py.modules.IcePy.Communicator.cpp.diff	                        (rev 0)
+++ trunk/dports/python/py-zeroc-ice35/files/patch-ice.py.modules.IcePy.Communicator.cpp.diff	2013-08-28 05:19:47 UTC (rev 110180)
@@ -0,0 +1,50 @@
+From 0192ae4c125ec66696b044a6e64bed5708977c31 Mon Sep 17 00:00:00 2001
+From: J Robert Ray <jrray at imageworks.com>
+Date: Wed, 3 Jul 2013 10:49:53 -0700
+Subject: [PATCH] Support custom Ice::Dispatchers in Python (sort of).
+
+This is a very thin shim to expose the InitializationData::dispatcher
+member, but not a way to implement an Ice::Dispatcher in Python.
+
+Extend the wrapped Ice.InitializationData to check for a 'dispatcher'
+attribute. In Python, the user is to pass in a PyCObject-wrapped
+Ice::Dispatcher*.
+
+The custom Ice::Dispatcher must still be implemented in C++, and also
+exposed to Python in some way.
+---
+ py/modules/IcePy/Communicator.cpp | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/py/modules/IcePy/Communicator.cpp b/py/modules/IcePy/Communicator.cpp
+index 43d2e73..9d19221 100644
+--- a/py/modules/IcePy/Communicator.cpp
++++ b/py/modules/IcePy/Communicator.cpp
+@@ -145,6 +145,7 @@ communicatorInit(CommunicatorObject* self, PyObject* args, PyObject* /*kwds*/)
+         PyObjectHandle properties = PyObject_GetAttrString(initData, STRCAST("properties"));
+         PyObjectHandle logger = PyObject_GetAttrString(initData, STRCAST("logger"));
+         PyObjectHandle threadHook = PyObject_GetAttrString(initData, STRCAST("threadHook"));
++        PyObjectHandle dispatcher = PyObject_GetAttrString(initData, STRCAST("dispatcher"));
+         PyErr_Clear(); // PyObject_GetAttrString sets an error on failure.
+ 
+         if(properties.get() && properties.get() != Py_None)
+@@ -166,6 +167,16 @@ communicatorInit(CommunicatorObject* self, PyObject* args, PyObject* /*kwds*/)
+         {
+             data.threadHook = new ThreadHook(threadHook.get());
+         }
++
++        if(dispatcher.get() && dispatcher.get() != Py_None)
++        {
++            if (!PyCObject_Check(dispatcher.get())) {
++                PyErr_Format(PyExc_ValueError, STRCAST("Ice.InitializationData dispatcher must be a PyCObject-wrapped Ice::Dispatcher*"));
++                return -1;
++            }
++
++            data.dispatcher = reinterpret_cast<Ice::Dispatcher*>(PyCObject_AsVoidPtr(dispatcher.get()));
++        }
+     }
+ 
+     try
+-- 
+1.8.1.3
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130827/fb5501f2/attachment.html>


More information about the macports-changes mailing list