Discussion:
[omniORB] python behavior for CORBA.Any() and omniORB.to_any()
Thomas Lockhart
2006-09-27 08:05:43 UTC
Permalink
I'm using omniORB-4.0.7 and omniORBpy-2.7. I am seeing what may be an
inconsistency in handling CORBA anys, or at least in my understanding of
how to use them. In constructing a CORBA any, I notice the following
x = any.to_any(3)
print x.typecode()
CORBA.TC_long
y = CORBA.Any(CORBA.TC_long, 3)
print y.typecode()
<CORBA.TypeCode 'IDL:omg.org/CORBA/long:1.0'>

Where for the first case returning the any to a co-located python client
succeeds but the latter case fails with the following:

omniORB: throw BAD_PARAM from pyMarshal.cc:3834
(MAYBE,BAD_PARAM_WrongPythonType)

afaict the latter case should be legal and is suggested in the version
1.2 Python mapping spec from OMG.

fwiw there is a different behavior from omniORBpy-2.6, details are shown
below (I haven't tested the actual results of returning an any for 2.6
in this simple test case, but have used CORBA.Any() to pass results of
sequences of longs etc to other applications in the past). Anyway, hints
and suggestions would be appreciated. Thanks!

- Tom
x = omniORB.any.to_any(3)
print x.typecode()
<omniORB.tcInternal.TypeCode_empty instance at 0xb7a751cc>
x = omniORB.any.to_any(int(3))
print x.typecode()
<omniORB.tcInternal.TypeCode_empty instance at 0xb7a751cc>
x = CORBA.Any(CORBA.TC_long, 3)
print x.typecode()
<omniORB.tcInternal.TypeCode_empty instance at 0xb7a751cc>
Luke Deller
2006-09-27 08:45:24 UTC
Permalink
Hi Thomas.
y = CORBA.Any(CORBA.TC_long, 3)
print y.typecode()
<CORBA.TypeCode 'IDL:omg.org/CORBA/long:1.0'>

The above string is not produced by omniORBpy 2.7. Perhaps your "CORBA"
module refers to a different CORBA ORB, such as the one used for GNOME?
CORBA
CORBA.__file__
There may be an easy workaround, such as using "from omniORB import
CORBA" rather than "import CORBA".

Regards,
Luke.


**********************************************************************************************

Important Note
This email (including any attachments) contains information which is
confidential and may be subject to legal privilege. If you are not
the intended recipient you must not use, distribute or copy this
email. If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this
email are not necessarily the views of XPlan Technology.

It is the duty of the recipient to virus scan and otherwise test the
information provided before loading onto any computer system.
Xplan Technology does not warrant that the
information is free of a virus or any other defect or error.
**********************************************************************************************
Thomas Lockhart
2006-09-29 03:19:50 UTC
Permalink
... In constructing a CORBA any, I notice the
following behavior...
That was so long ago. Today things work just fine, with no apparent
changes in my code :/

- Tom

Loading...