[32228] trunk/dports/devel/ice-python
blair at macports.org
blair at macports.org
Thu Dec 20 12:54:00 PST 2007
Revision: 32228
http://trac.macosforge.org/projects/macports/changeset/32228
Author: blair at macports.org
Date: 2007-12-20 12:53:58 -0800 (Thu, 20 Dec 2007)
Log Message:
-----------
New patch from upstream that allows the ServantLocator's locate() and
finished() methods throw user exceptions that are properly returned to
the client.
This port now requires that the latest ice-cpp port be built first to
pick up changes in the C++ libraries.
Modified Paths:
--------------
trunk/dports/devel/ice-python/Portfile
Added Paths:
-----------
trunk/dports/devel/ice-python/files/patch-ServantLocator.locate-can-throw-user-exceptions
Modified: trunk/dports/devel/ice-python/Portfile
===================================================================
--- trunk/dports/devel/ice-python/Portfile 2007-12-20 20:53:05 UTC (rev 32227)
+++ trunk/dports/devel/ice-python/Portfile 2007-12-20 20:53:58 UTC (rev 32228)
@@ -3,6 +3,7 @@
PortSystem 1.0
name ice-python
version 3.2.1
+revision 1
categories devel python
maintainers blair
description Fast, object-oriented RPC for C++, Java, Python, Ruby, PHP
@@ -38,7 +39,8 @@
port:ice-cpp
patchfiles patch-config.Make.rules \
- patch-config.Make.rules.Darwin
+ patch-config.Make.rules.Darwin \
+ patch-ServantLocator.locate-can-throw-user-exceptions
use_configure no
Added: trunk/dports/devel/ice-python/files/patch-ServantLocator.locate-can-throw-user-exceptions
===================================================================
--- trunk/dports/devel/ice-python/files/patch-ServantLocator.locate-can-throw-user-exceptions (rev 0)
+++ trunk/dports/devel/ice-python/files/patch-ServantLocator.locate-can-throw-user-exceptions 2007-12-20 20:53:58 UTC (rev 32228)
@@ -0,0 +1,960 @@
+diff -ru ../IcePy-3.2.1.orig/modules/IcePy/.depend ./modules/IcePy/.depend
+--- ../IcePy-3.2.1.orig/modules/IcePy/.depend 2007-08-08 12:00:54.000000000 -0700
++++ ./modules/IcePy/.depend 2007-12-20 12:26:37.000000000 -0800
+@@ -1,15 +1,15 @@
+-Communicator$(OBJEXT): Communicator.cpp Communicator.h Config.h ImplicitContext.h Logger.h Util.h ObjectAdapter.h ObjectFactory.h Properties.h Proxy.h ThreadNotification.h
+-Connection$(OBJEXT): Connection.cpp Connection.h Config.h ObjectAdapter.h Proxy.h Util.h
+-Current$(OBJEXT): Current.cpp Current.h Config.h Connection.h ObjectAdapter.h Util.h
+-ImplicitContext$(OBJEXT): ImplicitContext.cpp ImplicitContext.h Config.h ObjectAdapter.h Proxy.h Util.h
+-Init$(OBJEXT): Init.cpp Communicator.h Config.h Connection.h Current.h ImplicitContext.h Logger.h Util.h ObjectAdapter.h Operation.h Properties.h Proxy.h Slice.h Types.h
+-Logger$(OBJEXT): Logger.cpp Logger.h Config.h Util.h
+-ObjectAdapter$(OBJEXT): ObjectAdapter.cpp ObjectAdapter.h Config.h Communicator.h Current.h Operation.h Proxy.h Util.h
+-ObjectFactory$(OBJEXT): ObjectFactory.cpp ObjectFactory.h Config.h Types.h Util.h
+-Operation$(OBJEXT): Operation.cpp Operation.h Config.h Current.h Proxy.h Types.h Util.h
+-Properties$(OBJEXT): Properties.cpp Properties.h Config.h Util.h
+-Proxy$(OBJEXT): Proxy.cpp Proxy.h Config.h Communicator.h Connection.h Util.h
+-Slice$(OBJEXT): Slice.cpp Slice.h Config.h Util.h
+-ThreadNotification$(OBJEXT): ThreadNotification.cpp ThreadNotification.h Config.h Util.h
+-Types$(OBJEXT): Types.cpp Types.h Config.h Util.h Current.h Proxy.h
+-Util$(OBJEXT): Util.cpp Util.h Config.h
++Communicator$(OBJEXT): Communicator.cpp ./Communicator.h ./Config.h ./ImplicitContext.h ./Logger.h ./Util.h ./ObjectAdapter.h ./ObjectFactory.h ./Properties.h ./Proxy.h ./ThreadNotification.h
++Connection$(OBJEXT): Connection.cpp ./Connection.h ./Config.h ./ObjectAdapter.h ./Proxy.h ./Util.h
++Current$(OBJEXT): Current.cpp ./Current.h ./Config.h ./Connection.h ./ObjectAdapter.h ./Util.h
++ImplicitContext$(OBJEXT): ImplicitContext.cpp ./ImplicitContext.h ./Config.h ./ObjectAdapter.h ./Proxy.h ./Util.h
++Init$(OBJEXT): Init.cpp ./Communicator.h ./Config.h ./Connection.h ./Current.h ./ImplicitContext.h ./Logger.h ./Util.h ./ObjectAdapter.h ./Operation.h ./Properties.h ./Proxy.h ./Slice.h ./Types.h
++Logger$(OBJEXT): Logger.cpp ./Logger.h ./Config.h ./Util.h
++ObjectAdapter$(OBJEXT): ObjectAdapter.cpp ./ObjectAdapter.h ./Config.h ./Communicator.h ./Current.h ./Operation.h ./Proxy.h ./Types.h ./Util.h
++ObjectFactory$(OBJEXT): ObjectFactory.cpp ./ObjectFactory.h ./Config.h ./Types.h ./Util.h
++Operation$(OBJEXT): Operation.cpp ./Operation.h ./Config.h ./Current.h ./Proxy.h ./Types.h ./Util.h
++Properties$(OBJEXT): Properties.cpp ./Properties.h ./Config.h ./Util.h
++Proxy$(OBJEXT): Proxy.cpp ./Proxy.h ./Config.h ./Communicator.h ./Connection.h ./Operation.h ./Util.h
++Slice$(OBJEXT): Slice.cpp ./Slice.h ./Config.h ./Util.h
++ThreadNotification$(OBJEXT): ThreadNotification.cpp ./ThreadNotification.h ./Config.h ./Util.h
++Types$(OBJEXT): Types.cpp ./Types.h ./Config.h ./Util.h ./Current.h ./Proxy.h
++Util$(OBJEXT): Util.cpp ./Util.h ./Config.h
+diff -ru ../IcePy-3.2.1.orig/modules/IcePy/Communicator.cpp ./modules/IcePy/Communicator.cpp
+--- ../IcePy-3.2.1.orig/modules/IcePy/Communicator.cpp 2007-08-08 12:00:54.000000000 -0700
++++ ./modules/IcePy/Communicator.cpp 2007-12-20 12:26:37.000000000 -0800
+@@ -161,11 +161,18 @@
+ {
+ data.threadHook = new ThreadNotificationWrapper(threadHook.get());
+ }
++ }
+
++ try
++ {
++ data.properties = Ice::createProperties(seq, data.properties);
++ }
++ catch(const Ice::Exception& ex)
++ {
++ setPythonException(ex);
++ return -1;
+ }
+
+- data.properties = Ice::createProperties(seq, data.properties);
+-
+ //
+ // Disable collocation optimization, otherwise a Python invocation on
+ // a collocated servant results in a CollocationOptimizationException
+@@ -200,7 +207,7 @@
+ }
+ catch(const Ice::Exception& ex)
+ {
+- for(i = 0; i < argc + 1; ++i)
++ for(i = 0; i < argc; ++i)
+ {
+ free(argv[i]);
+ }
+@@ -224,7 +231,7 @@
+ }
+ }
+
+- for(i = 0; i < argc + 1; ++i)
++ for(i = 0; i < argc; ++i)
+ {
+ free(argv[i]);
+ }
+diff -ru ../IcePy-3.2.1.orig/modules/IcePy/ObjectAdapter.cpp ./modules/IcePy/ObjectAdapter.cpp
+--- ../IcePy-3.2.1.orig/modules/IcePy/ObjectAdapter.cpp 2007-08-08 12:00:54.000000000 -0700
++++ ./modules/IcePy/ObjectAdapter.cpp 2007-12-20 12:26:37.000000000 -0800
+@@ -15,6 +15,7 @@
+ #include <Current.h>
+ #include <Operation.h>
+ #include <Proxy.h>
++#include <Types.h>
+ #include <Util.h>
+ #include <Ice/Communicator.h>
+ #include <Ice/LocalException.h>
+@@ -226,7 +227,21 @@
+ PyObjectHandle res = PyObject_CallMethod(_locator, STRCAST("locate"), STRCAST("O"), c->current);
+ if(PyErr_Occurred())
+ {
+- throwPythonException();
++ PyException ex;
++
++ PyObject* userExceptionType = lookupType("Ice.UserException");
++ if(PyObject_IsInstance(ex.ex.get(), userExceptionType))
++ {
++ PyObjectHandle iceType = PyObject_GetAttrString(ex.ex.get(), STRCAST("ice_type"));
++ assert(iceType.get());
++ ExceptionInfoPtr info = ExceptionInfoPtr::dynamicCast(getException(iceType.get()));
++ assert(info);
++ info->raise(ex.ex.get(), current.adapter->getCommunicator());
++ }
++ else
++ {
++ ex.raise();
++ }
+ }
+
+ if(res.get() == Py_None)
+@@ -274,7 +289,8 @@
+ }
+
+ void
+-IcePy::ServantLocatorWrapper::finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr& cookie)
++IcePy::ServantLocatorWrapper::finished(const Ice::Current& current, const Ice::ObjectPtr&,
++ const Ice::LocalObjectPtr& cookie)
+ {
+ CookiePtr c = CookiePtr::dynamicCast(cookie);
+ assert(c);
+@@ -286,7 +302,21 @@
+ servantObj.get(), c->cookie);
+ if(PyErr_Occurred())
+ {
+- throwPythonException();
++ PyException ex;
++
++ PyObject* userExceptionType = lookupType("Ice.UserException");
++ if(PyObject_IsInstance(ex.ex.get(), userExceptionType))
++ {
++ PyObjectHandle iceType = PyObject_GetAttrString(ex.ex.get(), STRCAST("ice_type"));
++ assert(iceType.get());
++ ExceptionInfoPtr info = ExceptionInfoPtr::dynamicCast(getException(iceType.get()));
++ assert(info);
++ info->raise(ex.ex.get(), current.adapter->getCommunicator());
++ }
++ else
++ {
++ ex.raise();
++ }
+ }
+ }
+
+diff -ru ../IcePy-3.2.1.orig/modules/IcePy/Operation.cpp ./modules/IcePy/Operation.cpp
+--- ../IcePy-3.2.1.orig/modules/IcePy/Operation.cpp 2007-08-08 12:00:54.000000000 -0700
++++ ./modules/IcePy/Operation.cpp 2007-12-20 12:26:37.000000000 -0800
+@@ -50,6 +50,7 @@
+
+ OperationI(const char*, PyObject*, PyObject*, int, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*);
+
++ virtual PyObject* invoke(const Ice::ObjectPrx&, PyObject*);
+ virtual PyObject* invoke(const Ice::ObjectPrx&, PyObject*, PyObject*);
+ virtual PyObject* invokeAsync(const Ice::ObjectPrx&, PyObject*, PyObject*, PyObject*);
+ virtual void deprecate(const string&);
+@@ -476,6 +477,37 @@
+ }
+
+ PyObject*
++IcePy::OperationI::invoke(const Ice::ObjectPrx& proxy, PyObject* args)
++{
++ //
++ // This method is used when the optional context argument may be included in the args tuple.
++ //
++
++ assert(PyTuple_Check(args));
++
++ PyObject* ctx = Py_None;
++
++ PyObjectHandle slice;
++ if(PyTuple_GET_SIZE(args) > static_cast<Py_ssize_t>(_inParams.size()))
++ {
++ ctx = PyTuple_GET_ITEM(args, PyTuple_GET_SIZE(args) - 1);
++ if(ctx != Py_None && !PyDict_Check(ctx))
++ {
++ PyErr_Format(PyExc_ValueError, STRCAST("context argument must be None or a dictionary"));
++ return 0;
++ }
++ slice = PyTuple_GetSlice(args, 0, PyTuple_GET_SIZE(args) - 1);
++ }
++ else
++ {
++ slice = args;
++ Py_INCREF(args);
++ }
++
++ return invoke(proxy, slice.get(), ctx);
++}
++
++PyObject*
+ IcePy::OperationI::invoke(const Ice::ObjectPrx& proxy, PyObject* args, PyObject* pyctx)
+ {
+ Ice::CommunicatorPtr communicator = proxy->ice_getCommunicator();
+@@ -991,6 +1023,9 @@
+ else
+ {
+ Ice::OutputStreamPtr os = Ice::createOutputStream(communicator);
++
++ os->writeBool(info->usesClasses);
++
+ ObjectMap objectMap;
+ info->marshal(ex.ex.get(), os, &objectMap);
+
+diff -ru ../IcePy-3.2.1.orig/modules/IcePy/Operation.h ./modules/IcePy/Operation.h
+--- ../IcePy-3.2.1.orig/modules/IcePy/Operation.h 2007-08-08 12:00:54.000000000 -0700
++++ ./modules/IcePy/Operation.h 2007-12-20 12:26:37.000000000 -0800
+@@ -24,6 +24,7 @@
+
+ virtual ~Operation();
+
++ virtual PyObject* invoke(const Ice::ObjectPrx&, PyObject*) = 0;
+ virtual PyObject* invoke(const Ice::ObjectPrx&, PyObject*, PyObject*) = 0;
+ virtual PyObject* invokeAsync(const Ice::ObjectPrx&, PyObject*, PyObject*, PyObject*) = 0;
+ virtual void deprecate(const std::string&) = 0;
+diff -ru ../IcePy-3.2.1.orig/modules/IcePy/Proxy.cpp ./modules/IcePy/Proxy.cpp
+--- ../IcePy-3.2.1.orig/modules/IcePy/Proxy.cpp 2007-08-08 12:00:54.000000000 -0700
++++ ./modules/IcePy/Proxy.cpp 2007-12-20 12:26:37.000000000 -0800
+@@ -15,6 +15,7 @@
+ #include <structmember.h>
+ #include <Communicator.h>
+ #include <Connection.h>
++#include <Operation.h>
+ #include <Util.h>
+ #include <Ice/Communicator.h>
+ #include <Ice/LocalException.h>
+@@ -220,47 +221,17 @@
+ static PyObject*
+ proxyIceIsA(ProxyObject* self, PyObject* args)
+ {
+- char* type;
+- PyObject* ctx = 0;
+- if(!PyArg_ParseTuple(args, STRCAST("s|O!"), &type, &PyDict_Type, &ctx))
+- {
+- return 0;
+- }
+-
+ assert(self->proxy);
+
+- bool b;
+- try
+- {
+- AllowThreads allowThreads; // Release Python's global interpreter lock during remote invocations.
+- if(ctx)
+- {
+- Ice::Context context;
+- if(!dictionaryToContext(ctx, context))
+- {
+- return 0;
+- }
+- b = (*self->proxy)->ice_isA(type, context);
+- }
+- else
+- {
+- b = (*self->proxy)->ice_isA(type);
+- }
+- }
+- catch(const Ice::Exception& ex)
+- {
+- setPythonException(ex);
+- return 0;
+- }
++ PyObject* objectType = lookupType("Ice.Object");
++ assert(objectType);
++ PyObjectHandle obj = PyObject_GetAttrString(objectType, "_op_ice_isA");
++ assert(obj.get());
+
+- if(b)
+- {
+- PyRETURN_TRUE;
+- }
+- else
+- {
+- PyRETURN_FALSE;
+- }
++ OperationPtr op = getOperation(obj.get());
++ assert(op);
++
++ return op->invoke(*self->proxy, args);
+ }
+
+ #ifdef WIN32
+@@ -269,39 +240,17 @@
+ static PyObject*
+ proxyIcePing(ProxyObject* self, PyObject* args)
+ {
+- PyObject* ctx = 0;
+- if(!PyArg_ParseTuple(args, STRCAST("|O!"), &PyDict_Type, &ctx))
+- {
+- return 0;
+- }
+-
+ assert(self->proxy);
+
+- try
+- {
+- AllowThreads allowThreads; // Release Python's global interpreter lock during remote invocations.
+- if(ctx)
+- {
+- Ice::Context context;
+- if(!dictionaryToContext(ctx, context))
+- {
+- return 0;
+- }
+- (*self->proxy)->ice_ping(context);
+- }
+- else
+- {
+- (*self->proxy)->ice_ping();
+- }
+- }
+- catch(const Ice::Exception& ex)
+- {
+- setPythonException(ex);
+- return 0;
+- }
++ PyObject* objectType = lookupType("Ice.Object");
++ assert(objectType);
++ PyObjectHandle obj = PyObject_GetAttrString(objectType, "_op_ice_ping");
++ assert(obj.get());
+
+- Py_INCREF(Py_None);
+- return Py_None;
++ OperationPtr op = getOperation(obj.get());
++ assert(op);
++
++ return op->invoke(*self->proxy, args);
+ }
+
+ #ifdef WIN32
+@@ -310,45 +259,17 @@
+ static PyObject*
+ proxyIceIds(ProxyObject* self, PyObject* args)
+ {
+- PyObject* ctx = 0;
+- if(!PyArg_ParseTuple(args, STRCAST("|O!"), &PyDict_Type, &ctx))
+- {
+- return 0;
+- }
+-
+ assert(self->proxy);
+
+- Ice::StringSeq ids;
+- try
+- {
+- AllowThreads allowThreads; // Release Python's global interpreter lock during remote invocations.
+- if(ctx)
+- {
+- Ice::Context context;
+- if(!dictionaryToContext(ctx, context))
+- {
+- return 0;
+- }
+- ids = (*self->proxy)->ice_ids(context);
+- }
+- else
+- {
+- ids = (*self->proxy)->ice_ids();
+- }
+- }
+- catch(const Ice::Exception& ex)
+- {
+- setPythonException(ex);
+- return 0;
+- }
++ PyObject* objectType = lookupType("Ice.Object");
++ assert(objectType);
++ PyObjectHandle obj = PyObject_GetAttrString(objectType, "_op_ice_ids");
++ assert(obj.get());
+
+- PyObject* list = PyList_New(0);
+- if(!list || !stringSeqToList(ids, list))
+- {
+- return 0;
+- }
++ OperationPtr op = getOperation(obj.get());
++ assert(op);
+
+- return list;
++ return op->invoke(*self->proxy, args);
+ }
+
+ #ifdef WIN32
+@@ -357,39 +278,17 @@
+ static PyObject*
+ proxyIceId(ProxyObject* self, PyObject* args)
+ {
+- PyObject* ctx = 0;
+- if(!PyArg_ParseTuple(args, STRCAST("|O!"), &PyDict_Type, &ctx))
+- {
+- return 0;
+- }
+-
+ assert(self->proxy);
+
+- string id;
+- try
+- {
+- AllowThreads allowThreads; // Release Python's global interpreter lock during remote invocations.
+- if(ctx)
+- {
+- Ice::Context context;
+- if(!dictionaryToContext(ctx, context))
+- {
+- return 0;
+- }
+- id = (*self->proxy)->ice_id(context);
+- }
+- else
+- {
+- id = (*self->proxy)->ice_id();
+- }
+- }
+- catch(const Ice::Exception& ex)
+- {
+- setPythonException(ex);
+- return 0;
+- }
++ PyObject* objectType = lookupType("Ice.Object");
++ assert(objectType);
++ PyObjectHandle obj = PyObject_GetAttrString(objectType, "_op_ice_id");
++ assert(obj.get());
++
++ OperationPtr op = getOperation(obj.get());
++ assert(op);
+
+- return Py_BuildValue(STRCAST("s"), id.c_str());
++ return op->invoke(*self->proxy, args);
+ }
+
+ #ifdef WIN32
+diff -ru ../IcePy-3.2.1.orig/modules/IcePy/Types.cpp ./modules/IcePy/Types.cpp
+--- ../IcePy-3.2.1.orig/modules/IcePy/Types.cpp 2007-08-08 12:00:54.000000000 -0700
++++ ./modules/IcePy/Types.cpp 2007-12-20 12:26:37.000000000 -0800
+@@ -16,6 +16,8 @@
+ #include <Util.h>
+ #include <IceUtil/InputUtil.h>
+ #include <IceUtil/ScopedArray.h>
++#include <Ice/BasicStream.h>
++#include <Ice/Initialize.h>
+ #include <Ice/LocalException.h>
+
+ using namespace std;
+@@ -2284,6 +2286,107 @@
+ }
+ }
+
++namespace
++{
++
++//
++// Subclass of UserException that wraps a Python user exception.
++//
++class UserExceptionWrapper : public Ice::UserException
++{
++public:
++
++ UserExceptionWrapper(PyObject*, const ExceptionInfoPtr&, const Ice::CommunicatorPtr&);
++ virtual ~UserExceptionWrapper() throw() { }
++
++ virtual string ice_name() const;
++ virtual Ice::Exception* ice_clone() const;
++ virtual void ice_throw() const;
++
++ virtual void __write(IceInternal::BasicStream*) const;
++ virtual void __read(IceInternal::BasicStream*, bool);
++
++ virtual bool __usesClasses() const;
++
++private:
++
++ PyObjectHandle _ex;
++ ExceptionInfoPtr _info;
++ Ice::CommunicatorPtr _communicator;
++};
++
++UserExceptionWrapper::UserExceptionWrapper(PyObject* ex, const ExceptionInfoPtr& info,
++ const Ice::CommunicatorPtr& communicator) :
++ _ex(ex), _info(info), _communicator(communicator)
++{
++ Py_INCREF(ex);
++}
++
++string
++UserExceptionWrapper::ice_name() const
++{
++ return _info->id;
++}
++
++Ice::Exception*
++UserExceptionWrapper::ice_clone() const
++{
++ return new UserExceptionWrapper(*this);
++}
++
++void
++UserExceptionWrapper::ice_throw() const
++{
++ throw *this;
++}
++
++void
++UserExceptionWrapper::__write(IceInternal::BasicStream* os) const
++{
++ //
++ // To marshal a Python user exception into a BasicStream, we first
++ // marshal it into an OutputStream and then write the marshaled
++ // bytes as a blob into the BasicStream.
++ //
++ Ice::OutputStreamPtr stream = Ice::createOutputStream(_communicator);
++
++ //
++ // The C++ run time is in charge of marshaling this exception; as such, it has
++ // already written the "usesClasses" boolean to the stream so we must not
++ // write it again.
++ //
++ ObjectMap objectMap;
++ _info->marshal(const_cast<PyObject*>(_ex.get()), stream, &objectMap);
++
++ //
++ // It is safe to flush any pending objects here. The C++ run time will also
++ // flush the pending objects on the BasicStream, but there will never be
++ // any objects pending on that stream.
++ //
++ if(_info->usesClasses)
++ {
++ stream->writePendingObjects();
++ }
++
++ Ice::ByteSeq bytes;
++ stream->finished(bytes);
++ os->writeBlob(bytes);
++}
++
++void
++UserExceptionWrapper::__read(IceInternal::BasicStream*, bool)
++{
++ assert(false);
++}
++
++bool
++UserExceptionWrapper::__usesClasses() const
++{
++ return _info->usesClasses;
++}
++
++}
++
+ //
+ // ExceptionInfo implementation.
+ //
+@@ -2296,8 +2399,6 @@
+ throw AbortMarshaling();
+ }
+
+- os->writeBool(usesClasses);
+-
+ ExceptionInfoPtr info = this;
+ while(info)
+ {
+@@ -2405,6 +2506,12 @@
+ }
+ }
+
++void
++IcePy::ExceptionInfo::raise(PyObject* ex, const Ice::CommunicatorPtr& communicator)
++{
++ throw UserExceptionWrapper(ex, this, communicator);
++}
++
+ //
+ // lookupClassInfo()
+ //
+diff -ru ../IcePy-3.2.1.orig/modules/IcePy/Types.h ./modules/IcePy/Types.h
+--- ../IcePy-3.2.1.orig/modules/IcePy/Types.h 2007-08-08 12:00:54.000000000 -0700
++++ ./modules/IcePy/Types.h 2007-12-20 12:26:37.000000000 -0800
+@@ -356,6 +356,8 @@
+ void print(PyObject*, IceUtil::Output&);
+ void printMembers(PyObject*, IceUtil::Output&, PrintObjectHistory*);
+
++ void raise(PyObject*, const Ice::CommunicatorPtr&);
++
+ std::string id;
+ ExceptionInfoPtr base;
+ DataMemberList members;
+diff -ru ../IcePy-3.2.1.orig/modules/IcePy/Util.cpp ./modules/IcePy/Util.cpp
+--- ../IcePy-3.2.1.orig/modules/IcePy/Util.cpp 2007-08-08 12:00:54.000000000 -0700
++++ ./modules/IcePy/Util.cpp 2007-12-20 12:26:37.000000000 -0800
+@@ -58,7 +58,7 @@
+ }
+
+ PyObject*
+-IcePy::PyObjectHandle::get()
++IcePy::PyObjectHandle::get() const
+ {
+ return _p;
+ }
+diff -ru ../IcePy-3.2.1.orig/modules/IcePy/Util.h ./modules/IcePy/Util.h
+--- ../IcePy-3.2.1.orig/modules/IcePy/Util.h 2007-08-08 12:00:54.000000000 -0700
++++ ./modules/IcePy/Util.h 2007-12-20 12:26:37.000000000 -0800
+@@ -61,7 +61,7 @@
+ void operator=(PyObject*);
+ void operator=(const PyObjectHandle&);
+
+- PyObject* get();
++ PyObject* get() const;
+ PyObject* release();
+
+ private:
+diff -ru ../IcePy-3.2.1.orig/test/Ice/servantLocator/AllTests.py ./test/Ice/servantLocator/AllTests.py
+--- ../IcePy-3.2.1.orig/test/Ice/servantLocator/AllTests.py 2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/AllTests.py 2007-12-20 12:26:37.000000000 -0800
+@@ -18,63 +18,108 @@
+
+ try:
+ obj.requestFailedException()
+- test(false)
++ test(False)
+ except Ice.ObjectNotExistException, ex:
+ if not collocated:
+ test(ex.id == obj.ice_getIdentity())
+ test(ex.facet == obj.ice_getFacet())
+ test(ex.operation == "requestFailedException")
++ except:
++ test(False)
+
+ try:
+ obj.unknownUserException()
+- test(false)
++ test(False)
+ except Ice.UnknownUserException, ex:
+ test(ex.unknown == "reason")
+- pass
++ except:
++ test(False)
+
+ try:
+ obj.unknownLocalException()
+- test(false)
++ test(False)
+ except Ice.UnknownLocalException, ex:
+ test(ex.unknown == "reason")
+- pass
++ except:
++ test(False)
+
+ try:
+ obj.unknownException()
+- test(false)
++ test(False)
+ except Ice.UnknownException, ex:
+ test(ex.unknown == "reason")
+ pass
+
+ try:
+ obj.userException()
+- test(false)
++ test(False)
+ except Ice.UnknownUserException, ex:
+- #print ex.unknown
+- test(not collocated)
+- test(ex.unknown.find("Test.TestIntfUserException") >= 0)
+- except Test.TestIntfUserException:
+- test(collocated)
++ test(ex.unknown.find("Test::TestIntfUserException") >= 0)
++ except:
++ test(False)
+
+ try:
+ obj.localException()
+- test(false)
++ test(False)
+ except Ice.UnknownLocalException, ex:
+- #print ex.unknown
+ test(not collocated)
+ test(ex.unknown.find("Ice.SocketException") >= 0)
+ except SocketException:
+ test(collocated)
++ except:
++ test(False)
+
+ try:
+ obj.pythonException()
+- test(false)
++ test(False)
+ except Ice.UnknownException, ex:
+- #print ex.unknown
+- test(not collocated)
+ test(ex.unknown.find("RuntimeError: message") >= 0)
+- except RuntimeError:
+- test(collocated)
++ except:
++ test(False)
++
++ try:
++ obj.unknownExceptionWithServantException()
++ test(False)
++ except Ice.UnknownException, ex:
++ test(ex.unknown == "reason")
++ except:
++ test(False)
++
++ try:
++ obj.impossibleException(False)
++ test(False)
++ except Ice.UnknownUserException:
++ # Operation doesn't throw, but locate() and finshed() throw TestIntfUserException.
++ pass
++ except:
++ test(False)
++
++ try:
++ obj.impossibleException(True)
++ test(False)
++ except Ice.UnknownUserException:
++ # Operation doesn't throw, but locate() and finshed() throw TestIntfUserException.
++ pass
++ except:
++ test(False)
++
++ try:
++ obj.intfUserException(False)
++ test(False)
++ except Test.TestImpossibleException:
++ # Operation doesn't throw, but locate() and finished() throw TestImpossibleException.
++ pass
++ except:
++ test(False)
++
++ try:
++ obj.intfUserException(True)
++ test(False)
++ except Test.TestImpossibleException:
++ # Operation throws TestIntfUserException, but locate() and finished() throw TestImpossibleException.
++ pass
++ except:
++ test(False)
+
+ def allTests(communicator, collocated):
+ print "testing stringToProxy... ",
+@@ -90,6 +135,27 @@
+ test(obj == base)
+ print "ok"
+
++ print "testing ice_ids...",
++ sys.stdout.flush()
++ try:
++ obj = communicator.stringToProxy("category/locate:default -p 12010 -t 10000")
++ obj.ice_ids()
++ test(False)
++ except Ice.UnknownUserException, ex:
++ test(ex.unknown == "Test::TestIntfUserException")
++ except:
++ test(False)
++
++ try:
++ obj = communicator.stringToProxy("category/finished:default -p 12010 -t 10000")
++ obj.ice_ids()
++ test(False)
++ except Ice.UnknownUserException, ex:
++ test(ex.unknown == "Test::TestIntfUserException")
++ except:
++ test(False)
++ print "ok"
++
+ print "testing servant locator...",
+ sys.stdout.flush()
+ base = communicator.stringToProxy("category/locate:default -p 12010 -t 10000")
+diff -ru ../IcePy-3.2.1.orig/test/Ice/servantLocator/Test.ice ./test/Ice/servantLocator/Test.ice
+--- ../IcePy-3.2.1.orig/test/Ice/servantLocator/Test.ice 2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/Test.ice 2007-12-20 12:26:37.000000000 -0800
+@@ -17,6 +17,10 @@
+ {
+ };
+
++exception TestImpossibleException
++{
++};
++
+ interface TestIntf
+ {
+ void requestFailedException();
+@@ -27,6 +31,11 @@
+ void userException();
+ void pythonException();
+
++ void unknownExceptionWithServantException();
++
++ string impossibleException(bool throw) throws TestImpossibleException;
++ string intfUserException(bool throw) throws TestIntfUserException, TestImpossibleException;
++
+ void shutdown();
+ };
+
+diff -ru ../IcePy-3.2.1.orig/test/Ice/servantLocator/TestAMD.ice ./test/Ice/servantLocator/TestAMD.ice
+--- ../IcePy-3.2.1.orig/test/Ice/servantLocator/TestAMD.ice 2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/TestAMD.ice 2007-12-20 12:26:37.000000000 -0800
+@@ -17,6 +17,10 @@
+ {
+ };
+
++exception TestImpossibleException
++{
++};
++
+ ["amd"] interface TestIntf
+ {
+ void requestFailedException();
+@@ -27,6 +31,11 @@
+ void userException();
+ void pythonException();
+
++ void unknownExceptionWithServantException();
++
++ string impossibleException(bool throw) throws TestImpossibleException;
++ string intfUserException(bool throw) throws TestIntfUserException, TestImpossibleException;
++
+ void shutdown();
+ };
+
+diff -ru ../IcePy-3.2.1.orig/test/Ice/servantLocator/TestAMDI.py ./test/Ice/servantLocator/TestAMDI.py
+--- ../IcePy-3.2.1.orig/test/Ice/servantLocator/TestAMDI.py 2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/TestAMDI.py 2007-12-20 12:26:37.000000000 -0800
+@@ -38,6 +38,29 @@
+ def pythonException_async(self, cb, current=None):
+ cb.ice_response()
+
++ def unknownExceptionWithServantException_async(self, cb, current=None):
++ cb.ice_exception(Ice.ObjectNotExistException())
++
++ def impossibleException_async(self, cb, throw, current=None):
++ if throw:
++ cb.ice_exception(Test.TestImpossibleException())
++ else:
++ #
++ # Return a value so we can be sure that the stream position
++ # is reset correctly if finished() throws.
++ #
++ cb.ice_response("Hello")
++
++ def intfUserException_async(self, cb, throw, current=None):
++ if throw:
++ cb.ice_exception(Test.TestIntfUserException())
++ else:
++ #
++ # Return a value so we can be sure that the stream position
++ # is reset correctly if finished() throws.
++ #
++ cb.ice_response("Hello")
++
+ def shutdown_async(self, cb, current=None):
+ current.adapter.deactivate()
+ cb.ice_response()
+@@ -86,25 +109,25 @@
+ self._deactivated = True
+
+ def exception(self, current):
+- if current.operation == "requestFailedException":
++ if current.operation == "ice_ids":
++ raise Test.TestIntfUserException()
++ elif current.operation == "requestFailedException":
+ raise Ice.ObjectNotExistException()
+ elif current.operation == "unknownUserException":
+- ex = Ice.UnknownUserException()
+- ex.unknown = "reason"
+- raise ex
++ raise Ice.UnknownUserException("reason")
+ elif current.operation == "unknownLocalException":
+- ex = Ice.UnknownLocalException()
+- ex.unknown = "reason"
+- raise ex
++ raise Ice.UnknownLocalException("reason")
+ elif current.operation == "unknownException":
+- ex = Ice.UnknownException()
+- ex.unknown = "reason"
+- raise ex
++ raise Ice.UnknownException("reason")
+ elif current.operation == "userException":
+ raise Test.TestIntfUserException()
+ elif current.operation == "localException":
+- ex = Ice.SocketException()
+- ex.error = 0
+- raise ex
++ raise Ice.SocketException(0)
+ elif current.operation == "pythonException":
+ raise RuntimeError("message")
++ elif current.operation == "unknownExceptionWithServantException":
++ raise Ice.UnknownException("reason")
++ elif current.operation == "impossibleException":
++ raise Test.TestIntfUserException() # Yes, it really is meant to be TestIntfUserException.
++ elif current.operation == "intfUserException":
++ raise Test.TestImpossibleException() # Yes, it really is meant to be TestImpossibleException.
+diff -ru ../IcePy-3.2.1.orig/test/Ice/servantLocator/TestI.py ./test/Ice/servantLocator/TestI.py
+--- ../IcePy-3.2.1.orig/test/Ice/servantLocator/TestI.py 2007-08-08 12:00:54.000000000 -0700
++++ ./test/Ice/servantLocator/TestI.py 2007-12-20 12:26:37.000000000 -0800
+@@ -38,6 +38,27 @@
+ def pythonException(self, current=None):
+ pass
+
++ def unknownExceptionWithServantException(self, current=None):
++ raise Ice.ObjectNotExistException()
++
++ def impossibleException(self, throw, current=None):
++ if throw:
++ raise Test.TestImpossibleException()
++ #
++ # Return a value so we can be sure that the stream position
++ # is reset correctly if finished() throws.
++ #
++ return "Hello"
++
++ def intfUserException(self, throw, current=None):
++ if throw:
++ raise Test.TestIntfUserException()
++ #
++ # Return a value so we can be sure that the stream position
++ # is reset correctly if finished() throws.
++ #
++ return "Hello"
++
+ def shutdown(self, current=None):
+ current.adapter.deactivate()
+
+@@ -85,25 +106,25 @@
+ self._deactivated = True
+
+ def exception(self, current):
+- if current.operation == "requestFailedException":
++ if current.operation == "ice_ids":
++ raise Test.TestIntfUserException()
++ elif current.operation == "requestFailedException":
+ raise Ice.ObjectNotExistException()
+ elif current.operation == "unknownUserException":
+- ex = Ice.UnknownUserException()
+- ex.unknown = "reason"
+- raise ex
++ raise Ice.UnknownUserException("reason")
+ elif current.operation == "unknownLocalException":
+- ex = Ice.UnknownLocalException()
+- ex.unknown = "reason"
+- raise ex
++ raise Ice.UnknownLocalException("reason")
+ elif current.operation == "unknownException":
+- ex = Ice.UnknownException()
+- ex.unknown = "reason"
+- raise ex
++ raise Ice.UnknownException("reason")
+ elif current.operation == "userException":
+ raise Test.TestIntfUserException()
+ elif current.operation == "localException":
+- ex = Ice.SocketException()
+- ex.error = 0
+- raise ex
++ raise Ice.SocketException(0)
+ elif current.operation == "pythonException":
+ raise RuntimeError("message")
++ elif current.operation == "unknownExceptionWithServantException":
++ raise Ice.UnknownException("reason")
++ elif current.operation == "impossibleException":
++ raise Test.TestIntfUserException() # Yes, it really is meant to be TestIntfUserException.
++ elif current.operation == "intfUserException":
++ raise Test.TestImpossibleException() # Yes, it really is meant to be TestImpossibleException.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071220/878ae6b7/attachment-0001.html
More information about the macports-changes
mailing list