[omniORB] How to convert long integer in python to unsignedlong in CORBA

Luke Deller ldeller at xplantechnology.com
Fri Oct 28 11:11:39 BST 2005


Hi Vito,

On Thu, 2005-10-27 at 07:49 -0700, Vito Bica wrote:
> I have defined the following value in python:
> 
> x = 0x80000000
> 
> Python seems to interpret this as an unsigned value, and therefore makes it 
> a long integer (2147483648, one more than the maximum positive value 
> allowable for a signed 32 bit int).

Yes, this is the behaviour of Python since version 2.4.  You get a
negative value by putting a '-' sign at the front, just like for decimal
literals.

> I try to pass it as a value in a CORBA method that takes an argument of 
> CORBA type "Unsigned Long". Python balks, saying that it cannot convert the 
> python Long Integer type to an integer. What I really want is to get that 
> value passed as-is as an argument to that CORBA method. Is there anything I 
> can do in Python or with some omnipy fucntion that will map that 32 bit 
> value into the CORBA unsigned long argument?

This should work already.  I just double checked, using Python 2.4.1 and
omniORBpy 2.6, and I can pass 0x80000000 to a CORBA method with an IDL
unsigned long argument.

Can you give us instructions on how to replicate your error?

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.
**********************************************************************************************




More information about the omniORB-list mailing list