[omniORB] patch for python unmarshalling of union
Ted Horst
Ted.Horst@wdr.com
Mon, 14 Feb 2000 13:52:08 -0600
Hi all,
I just started using omniORB through the python bindings, and I ran into a
bug unmarshalling unions. The spec says:
* If the discriminant is not listed, and there is no default, the value is None.
But the unmarshalling code did not handle this case. The following patch
fixes the problem:
*** omni/src/lib/omniORBpy/modules/omnipy/pyMarshal.cc.orig Fri Feb 11
19:04:39 2000
--- omni/src/lib/omniORBpy/modules/omnipy/pyMarshal.cc Fri Feb 11 19:14:02 2000
***************
*** 1665,1670 ****
--- 1665,1674 ----
assert(PyTuple_Check(t_o));
value = unmarshalPyObject(stream, PyTuple_GET_ITEM(t_o, 2));
}
+ else {
+ value = Py_None;
+ Py_INCREF(value);
+ }
}
PyObject* untuple = PyTuple_New(2);
***************
*** 2090,2095 ****
--- 2094,2103 ----
if (t_o != Py_None) {
assert(PyTuple_Check(t_o));
value = unmarshalPyObject(stream, PyTuple_GET_ITEM(t_o, 2));
+ }
+ else {
+ value = Py_None;
+ Py_INCREF(value);
}
}
-----------------------------
Ted Horst <Ted.Horst@wdr.com>
"the day serious reasoning about programs becomes widespread is the day
most programmers abandon their craft to resume drug trafficking <wink>."
--Tim Peters on comp.lang.python