[omniORB] PATCH - compiling omniORB 3.05 / omniORBpy 1.5 with Python 2.3 final

Fazal Majid fmajid at kefta.com
Wed Jul 30 00:12:00 BST 2003


As Python 2.3 final just came out, I thought this might save you some time.
The patch below will make omniORB 3.05 work with Python 2.3.

More detailed explanation:

If you use the stcok omniORB 3.x distribution, it will fail with an
assertion at runtime regarding PyClass_Check applied to WorkerThreadClass

The reason is that omnipy.cc checks to see if WorkerThreadClass is a Python
class using the PyClass_Check macro, but as this class inherits from
threading.Thread, which is in Python 2.3 a new-style class (inheriting from
object), you have to use the macro PyType_Check instead.

Python 2.2.3 (#1, Jun  2 2003, 15:52:05)
[GCC 2.95.3 20010315 (release)] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
...     pass
...
>>> class Bar(object):
...     pass
...
>>> import threading
>>> type(Foo)
<type 'class'>
>>> type(Bar)
<type 'type'>
>>> type(threading.Thread)
<type 'class'>



Python 2.3 (#1, Jul 29 2003, 18:29:22)
[GCC 2.95.3 20010315 (release)] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
...     pass
...
>>> class Bar(object):
...     pass
...
>>> import threading
>>> type(Foo)
<type 'classobj'>
>>> type(Bar)
<type 'type'>
>>> type(threading.Thread)
<type 'type'>




The following patch will make omniORB 3.05 work with Python 2.3 final.

*** /home/majid/src/omni/src/lib/omniORBpy/modules/omni30/omnipy.cc~    Tue
Jul 29 22:47:12 2003
--- /home/majid/src/omni/src/lib/omniORBpy/modules/omni30/omnipy.cc     Tue
Jul 29 22:47:12 2003
***************
*** 393,399 ****
      OMNIORB_ASSERT(omniPy::pyCreateTypeCode);
      OMNIORB_ASSERT(PyFunction_Check(omniPy::pyCreateTypeCode));
      OMNIORB_ASSERT(omniPy::pyWorkerThreadClass);
!     OMNIORB_ASSERT(PyClass_Check(omniPy::pyWorkerThreadClass));
      OMNIORB_ASSERT(omniPy::pyWorkerThreadDel);
      OMNIORB_ASSERT(PyMethod_Check(omniPy::pyWorkerThreadDel));
      OMNIORB_ASSERT(omniPy::pyEmptyTuple);
--- 393,400 ----
      OMNIORB_ASSERT(omniPy::pyCreateTypeCode);
      OMNIORB_ASSERT(PyFunction_Check(omniPy::pyCreateTypeCode));
      OMNIORB_ASSERT(omniPy::pyWorkerThreadClass);
!     OMNIORB_ASSERT(PyClass_Check(omniPy::pyWorkerThreadClass)
!                  || PyType_Check(omniPy::pyWorkerThreadClass));
      OMNIORB_ASSERT(omniPy::pyWorkerThreadDel);
      OMNIORB_ASSERT(PyMethod_Check(omniPy::pyWorkerThreadDel));
      OMNIORB_ASSERT(omniPy::pyEmptyTuple);

--
Fazal Majid                          Chief Technology Officer
fmajid at kefta.com                     Kefta
Voice: +1 415 391 6881 ext 8014      153 Kearny St. Suite 209
Fax: +1 415 391 7097                 San Francisco, CA 94108, USA




More information about the omniORB-list mailing list