Re: Python-2.x "from __future__ import unicode_literals" brings BAD_PARAM

Jim Bell via omniORB-list <[email protected]> Mon, 11 Nov 2019 10:22:24 -0600
Newsgroups gmane.comp.corba.omniorb.user
Organization J. C. Bell & Associates, Inc.
Message-ID <[email protected]>
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.



_______________________________________________
omniORB-list mailing list
[email protected]
http://www.omniorb-support.com/mailman/listinfo/omniorb-list