[omniORB] Python-2.x "from __future__ import unicode_literals" brings BAD_PARAM

Jim Bell Jim at JC-Bell.com
Mon Nov 11 16:22:24 GMT 2019


On 2019-11-10 9:35 AM, Jim Bell wrote:
> ...
> I found that using "from __future__ import unicode_literals" wreaks 
> havoc on my app code, with every string parameter or field value 
> giving CORBA.BAD_PARAM/omniORB.BAD_PARAM_WrongPythonType.
>
> ...
>

Ok, so for posterity, here's what I've learned:

The proxy generated by omniidl goes pretty much straight into the C++ 
code at the invoke() line below. (Good for performance!)

...

   # Echo object reference
   class _objref_Echo (CORBA.Object):

       def echoString(self, *args):
           return self._obj.invoke("echoString", 
_0_Example.Echo._d_echoString, args)

...

That eventually reaches a table lookup in pyMarshal.cc, 
marshalPyObjectFns[], which takes you to marshalPyObjectString() (also 
in pyMarshal.cc), which in its PY_VERSION_HEX < 0x03... part, does the 
PyString_... functions.  So I think you'd have to look at the PyObject's 
type there, see if it's unicode and convert it.

And that's where I'm bagging it: keeping unicode_literals out seems like 
the way to go, and we see what happens when it's there.





More information about the omniORB-list mailing list