Index: bugfixes.xml
===================================================================
RCS file: /cvsroot/omniORBpy/bugfixes.xml,v
retrieving revision 1.1.2.22
retrieving revision 1.1.2.28
diff -u -u -r1.1.2.22 -r1.1.2.28
--- bugfixes.xml	2001/02/20 10:39:33	1.1.2.22
+++ bugfixes.xml	2001/06/12 10:56:01	1.1.2.28
@@ -1,13 +1,95 @@
 <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
-<?xml-stylesheet type="text/xsl" href="bugfixes.xsl"?>
+<?xml-stylesheet type="text/xml" href="bugfixes.xsl"?>
 
-<!-- The following bugs have been fixed since the omniORBpy 1.2     -->
+<!-- The following bugs have been fixed since the omniORBpy 1.3     -->
 <!-- release. This file is transformed into html with bugfixes.xsl. -->
 
 <!-- Editors: make sure the content you add is well-formed XML.     -->
 
 <buglist version="1.3">
 
-<nobugs/>
+<bug id="6" date="Tue Jun 12 11:19:56 BST 2001" user="dpg1">
+
+  <summary>Invalid generated code with complex IDL scoping</summary>
+  <reported>W. Eliot Kimber</reported>
+  <link
+  href="http://www.uk.research.att.com/omniORB/archives/2001-06/0085.html"/>
+  <text>
+  The omniidl back-end would generate invalid code for some complex
+  scoping cases.
+  </text>
+</bug>
+
+<bug id="5" date="Fri May 18 15:19:46 BST 2001" user="dpg1">
+
+  <summary>OverflowError with unsigned long / long long
+  constants</summary>
+  <reported>Carl Bray</reported>
+  <link
+  href="http://www.uk.research.att.com/omniORB/archives/2001-05/0183.html"/>
+  <text>
+  Due to a change in str() between Python 1.5.2 and Python 2.x,
+  constants mapped to Python long integers would be missing the 'L'
+  suffix when using Python 2.x.
+  </text>
+</bug>
+
+<bug id="4" date="Fri May 11 17:22:00 BST 2001" user="dpg1">
+
+  <summary>TypeCode.get_compact_typecode() broken</summary>
+  <reported>David Konerding</reported>
+  <text>
+  <code>get_compact_typecode()</code> had not been kept up-to-date
+  with the internal TypeCode interfaces.
+  </text>
+</bug>
+
+<bug id="3" date="Thu May  3 15:30:03 BST 2001" user="dpg1">
+
+  <summary>Deadlock when releasing object references</summary>
+  <reported>John Heintz</reported>
+  <link
+  href="http://www.uk.research.att.com/omniORB/archives/2001-05/0041.html"/>
+  <text>
+  Releasing object references can lock
+  <code>omni::internalLock</code>. Various places did this while
+  holding the Python interpreter lock, which could lead to deadlock
+  against threads holding <code>internalLock</code> and attempting to
+  lock the interpreter lock.
+  </text>
+</bug>
+
+<bug id="2" date="Mon Apr  9 12:40:02 BST 2001" user="dpg1">
+
+  <summary>BAD_TYPECODE exception with good TypeCode</summary>
+  <reported>Lars Immisch</reported>
+  <link
+  href="http://www.uk.research.att.com/omniORB/archives/2001-04/0061.html"/>
+  <text>
+  TypeCodes containing multiple references to a known enum could be
+  unmarshalled incorrectly, leading to a BAD_TYPECODE exception.
+  </text>
+</bug>
+
+<bug id="1" date="Mon Mar 19 11:33:37 GMT 2001" user="dpg1">
+
+  <summary>Invalid stub code for typedef to struct/union inside
+  interface</summary>
+  <reported>Jimmy Wilson</reported>
+  <link href="http://www.uk.research.att.com/omniORB/archives/2001-03/0119.html"/>
+  <text>
+  omniidl -bpython would generate invalid stub code for IDL like the
+  following:
+  <p/>
+  <pre>
+  interface I {
+    struct S {
+      long l;
+    };
+    typedef S T;
+  };
+  </pre>
+  </text>
+</bug>
 
 </buglist>
Index: bugfixes.xsl
===================================================================
RCS file: /cvsroot/omniORBpy/bugfixes.xsl,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -u -r1.1.2.8 -r1.1.2.9
--- bugfixes.xsl	2001/02/20 10:39:33	1.1.2.8
+++ bugfixes.xsl	2001/03/19 12:01:24	1.1.2.9
@@ -81,8 +81,8 @@
           <ul><li>Update from <a href="../cvs.html">CVS</a> in the
                   <code>"omnipy1_develop"</code> branch.</li>
 
-              <li>Apply <a href="ftp://ftp.uk.research.att.com/pub/omniORB/omniORBpy/omniORBpy_1_2_bugfixes.patch">this
-                  patch</a> to the omniORBpy 1.1 distribution.</li>
+              <li>Apply <a href="ftp://ftp.uk.research.att.com/pub/omniORB/omniORBpy/omniORBpy_1_3_bugfixes.patch">this
+                  patch</a> to the omniORBpy 1.3 distribution.</li>
 
               <li>Download the latest <a
               href="ftp://ftp.uk.research.att.com/pub/omniORB/omniORBpy_snapshots/">source
Index: update.log
===================================================================
RCS file: /cvsroot/omniORBpy/update.log,v
retrieving revision 1.28.2.47
retrieving revision 1.28.2.61
diff -u -u -r1.28.2.47 -r1.28.2.61
--- update.log	2001/02/20 10:39:33	1.28.2.47
+++ update.log	2001/06/12 10:56:01	1.28.2.61
@@ -1,21 +1,146 @@
+Tue Jun 12 11:19:56 BST 2001 dpg1
+=================================
+
+- Scoping bug in stub code.
+
+omniidl_be/python.py
+python/omniORB/__init__.py
+
+
+Fri May 18 15:19:46 BST 2001 dpg1
+=================================
+
+- Python long int constants fail on Python 2.x.
+
+omniidl_be/python.py
+
+
+Thu May 17 15:01:57 BST 2001 dpg1
+=================================
+
+- Implement _get_interface()
+
+python/omniORB/CORBA.py
+
+
+Mon May 14 15:17:31 BST 2001 dpg1
+=================================
+
+- TypeCode.equivalent() was broken in a similar manner to
+  get_compact_typecode()
+
+python/omniORB/tcInternal.py
+
+
+Mon May 14 11:02:47 BST 2001 dpg1
+=================================
+
+- Stupid bug in struct marshalling with inherited members.
+
+modules/common/pyMarshal.cc
+
+
+Fri May 11 17:22:00 BST 2001 dpg1
+=================================
+
+- TypeCode.get_compact_typecode() was broken.
+
+python/omniORB/tcInternal.py
+
+
+Thu May  3 15:30:03 BST 2001 dpg1
+=================================
+
+- Various places released object references while holding the
+  interpreter lock. Object reference deletion locks
+  omni::internalLock, so this could cause deadlocks against
+  Servant::_add_ref().
+
+modules/omni30/pyObjectRef.cc
+modules/omni30/pyPOAFunc.cc
+modules/omni30/pyServant.cc
+
+
+Tue May  1 12:14:57 BST 2001 dpg1
+=================================
+
+- omnipy_narrow() called createObjRef() while holding the interpreter
+  lock.
+
+modules/omni30/omnipy.cc
+
+
+Tue Apr 10 17:31:53 BST 2001 dpg1
+=================================
+
+- Minor bugs in Any coercion.
+
+python/omniORB/__init__.py
+
+
+Mon Apr  9 17:25:49 BST 2001 dpg1
+=================================
+
+- De-uglify ORB_init command line argument eating.
+
+modules/omni30/omnipy.cc
+
+
+Mon Apr  9 12:40:02 BST 2001 dpg1
+=================================
+
+- Forgot to add known enums to offset desctriptor map.
+
+modules/common/pyTypeCode.cc
+
+
+Mon Mar 19 11:33:37 GMT 2001 dpg1
+=================================
+
+- Invalid stub code generated for typedef to struct/union inside an
+  interface.
+
+omniidl_be/python.py
+
+
+Wed Mar 14 17:40:59 GMT 2001 dpg1
+=================================
+
+- Minor misuse of "global" statement, warned about by Python 2.1.
+
+examples/tests/tclient.py
+
+
+Mon Mar 12 10:19:08 GMT 2001 dpg1
+=================================
+
+- Missing try around object_to_string()
+
+modules/omni30/pyORBFunc.cc
+
+- Suppress annoying compiler warnings about uninitialised variables.
+
+modules/common/pyTypeCode.cc
+
+
 Tue Feb 20 10:34:35 GMT 2001 dpg1
 =================================
 
 - Updates for 1.3 release.
 
-src/lib/omniORBpy/bugfixes.xml
-src/lib/omniORBpy/bugfixes.xsl
-src/lib/omniORBpy/bugfixes12.xml                          -- new
-src/lib/omniORBpy/update.log
-src/lib/omniORBpy/doc/tex/omniORBpy.tex
-src/lib/omniORBpy/external_merge/ReleaseNote
-src/lib/omniORBpy/external_merge/THIS_IS_OMNIORBPY_1_2    -- deleted
-src/lib/omniORBpy/external_merge/THIS_IS_OMNIORBPY_1_3    -- new
-src/lib/omniORBpy/external_merge/doc/omniORBpy.pdf
-src/lib/omniORBpy/external_merge/doc/omniORBpy.ps
-src/lib/omniORBpy/external_merge/doc/omniORBpy/index.html
-src/lib/omniORBpy/external_merge/doc/omniORBpy/omniORBpy007.html
-src/lib/omniORBpy/modules/dir.mk
+bugfixes.xml
+bugfixes.xsl
+bugfixes12.xml                          -- new
+update.log
+doc/tex/omniORBpy.tex
+external_merge/ReleaseNote
+external_merge/THIS_IS_OMNIORBPY_1_2    -- deleted
+external_merge/THIS_IS_OMNIORBPY_1_3    -- new
+external_merge/doc/omniORBpy.pdf
+external_merge/doc/omniORBpy.ps
+external_merge/doc/omniORBpy/index.html
+external_merge/doc/omniORBpy/omniORBpy007.html
+modules/dir.mk
 
 
 Wed Feb 14 15:10:33 GMT 2001 dpg1
Index: examples/tests/tclient.py
===================================================================
RCS file: /cvsroot/omniORBpy/examples/tests/tclient.py,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -u -r1.3 -r1.3.2.1
--- examples/tests/tclient.py	2000/07/10 18:44:26	1.3
+++ examples/tests/tclient.py	2001/03/14 17:42:02	1.3.2.1
@@ -1520,7 +1520,6 @@
 
     if "-r" in sys.argv:
         print "\nRepeating tests..."
-        global output
         output = 0
         while 1:
             doTests(orb, poa, io)
Index: modules/common/pyMarshal.cc
===================================================================
RCS file: /cvsroot/omniORBpy/modules/common/pyMarshal.cc,v
retrieving revision 1.23.2.4
retrieving revision 1.23.2.5
diff -u -u -r1.23.2.4 -r1.23.2.5
--- modules/common/pyMarshal.cc	2000/09/21 13:20:15	1.23.2.4
+++ modules/common/pyMarshal.cc	2001/05/14 10:07:46	1.23.2.5
@@ -27,9 +27,12 @@
 // Description:
 //    Marshalling / unmarshalling of Python objects
 
-// $Id: pyMarshal.cc,v 1.23.2.4 2000/09/21 13:20:15 dpg1 Exp $
+// $Id: pyMarshal.cc,v 1.23.2.5 2001/05/14 10:07:46 dpg1 Exp $
 
 // $Log: pyMarshal.cc,v $
+// Revision 1.23.2.5  2001/05/14 10:07:46  dpg1
+// Stupid bug in struct marshalling with inherited members.
+//
 // Revision 1.23.2.4  2000/09/21 13:20:15  dpg1
 // Silly bug marshalling sequences of anys and TypeCodes
 //
@@ -439,34 +442,38 @@
 
 	PyObject* sdict = ((PyInstanceObject*)a_o)->in_dict;
 
-	for (i=0,j=4; i < cnt; i++) {
+	for (i=0,j=4; i < cnt; i++,j++) {
 	  name    = PyTuple_GET_ITEM(d_o, j++);
 	  OMNIORB_ASSERT(PyString_Check(name));
 	  value   = PyDict_GetItem(sdict, name);
 
 	  if (value) {
-	    msgsize = alignedSize(msgsize, PyTuple_GET_ITEM(d_o, j++),
+	    msgsize = alignedSize(msgsize, PyTuple_GET_ITEM(d_o, j),
 				  value, compstatus);
 	  }
 	  else {
 	    // Not such a fast case after all
 	    value = PyObject_GetAttr(a_o, name);
 	    if (!value) AS_THROW_BAD_PARAM;
-	    msgsize = alignedSize(msgsize, PyTuple_GET_ITEM(d_o, j++),
-				  value, compstatus);
+
+	    // DECREF now in case alignedSize() throws an exception.
+	    // Safe because the struct object still holds a reference
+	    // to the value.
 	    Py_DECREF(value);
+	    msgsize = alignedSize(msgsize, PyTuple_GET_ITEM(d_o, j),
+				  value, compstatus);
 	  }
 	}
       }
       else {
-	for (i=0,j=4; i < cnt; i++) {
+	for (i=0,j=4; i < cnt; i++,j++) {
 	  name    = PyTuple_GET_ITEM(d_o, j++);
 	  OMNIORB_ASSERT(PyString_Check(name));
 	  value   = PyObject_GetAttr(a_o, name);
 	  if (!value) AS_THROW_BAD_PARAM;
-	  msgsize = alignedSize(msgsize, PyTuple_GET_ITEM(d_o, j++),
-				value, compstatus);
 	  Py_DECREF(value);
+	  msgsize = alignedSize(msgsize, PyTuple_GET_ITEM(d_o, j),
+				value, compstatus);
 	}
       }
     }
@@ -1546,25 +1553,25 @@
 
       if (PyInstance_Check(a_o)) {
 	PyObject* sdict = ((PyInstanceObject*)a_o)->in_dict;
-	for (i=0,j=4; i < cnt; i++) {
+	for (i=0,j=4; i < cnt; i++,j++) {
 	  name  = PyTuple_GET_ITEM(d_o, j++);
 	  value = PyDict_GetItem(sdict, name);
 
 	  if (value) {
-	    marshalPyObject(stream, PyTuple_GET_ITEM(d_o, j++), value);
+	    marshalPyObject(stream, PyTuple_GET_ITEM(d_o, j), value);
 	  }
 	  else {
 	    value = PyObject_GetAttr(a_o, name);
-	    marshalPyObject(stream, PyTuple_GET_ITEM(d_o, j++), value);
 	    Py_DECREF(value);
+	    marshalPyObject(stream, PyTuple_GET_ITEM(d_o, j), value);
 	  }
 	}
       }
       else {
-	for (i=0,j=4; i < cnt; i++) {
+	for (i=0,j=4; i < cnt; i++,j++) {
 	  name  = PyTuple_GET_ITEM(d_o, j++);
 	  value = PyObject_GetAttr(a_o, name);
-	  marshalPyObject(stream, PyTuple_GET_ITEM(d_o, j++), value);
+	  marshalPyObject(stream, PyTuple_GET_ITEM(d_o, j), value);
 	  Py_DECREF(value);
 	}
       }
@@ -2469,25 +2476,25 @@
 
       if (PyInstance_Check(a_o)) {
 	PyObject* sdict = ((PyInstanceObject*)a_o)->in_dict;
-	for (i=0,j=4; i < cnt; i++) {
+	for (i=0,j=4; i < cnt; i++,j++) {
 	  name  = PyTuple_GET_ITEM(d_o, j++);
 	  value = PyDict_GetItem(sdict, name);
 
 	  if (value) {
-	    marshalPyObject(stream, PyTuple_GET_ITEM(d_o, j++), value);
+	    marshalPyObject(stream, PyTuple_GET_ITEM(d_o, j), value);
 	  }
 	  else {
 	    value = PyObject_GetAttr(a_o, name);
-	    marshalPyObject(stream, PyTuple_GET_ITEM(d_o, j++), value);
 	    Py_DECREF(value);
+	    marshalPyObject(stream, PyTuple_GET_ITEM(d_o, j), value);
 	  }
 	}
       }
       else {
-	for (i=0,j=4; i < cnt; i++) {
+	for (i=0,j=4; i < cnt; i++,j++) {
 	  name  = PyTuple_GET_ITEM(d_o, j++);
 	  value = PyObject_GetAttr(a_o, name);
-	  marshalPyObject(stream, PyTuple_GET_ITEM(d_o, j++), value);
+	  marshalPyObject(stream, PyTuple_GET_ITEM(d_o, j), value);
 	  Py_DECREF(value);
 	}
       }
@@ -4797,20 +4804,19 @@
 
 	PyObject* sdict = ((PyInstanceObject*)a_o)->in_dict;
 
-	for (i=0,j=4; i < cnt; i++) {
+	for (i=0,j=4; i < cnt; i++,j++) {
 	  name  = PyTuple_GET_ITEM(d_o, j++);
 	  OMNIORB_ASSERT(PyString_Check(name));
 	  value = PyDict_GetItem(sdict, name);
 
 	  if (value) {
-	    t_o = copyArgument(PyTuple_GET_ITEM(d_o, j++), value, compstatus);
+	    t_o = copyArgument(PyTuple_GET_ITEM(d_o, j), value, compstatus);
 	  }
 	  else {
 	    // Not such a fast case after all
 	    value = PyObject_GetAttr(a_o, name);
 	    if (value) {
-	      t_o = copyArgument(PyTuple_GET_ITEM(d_o, j++),
-				 value, compstatus);
+	      t_o = copyArgument(PyTuple_GET_ITEM(d_o, j), value, compstatus);
 	      Py_DECREF(value);
 	    }
 	  }
@@ -4818,36 +4824,24 @@
 	    PyTuple_SET_ITEM(argtuple, i, t_o);
 	  }
 	  else {
-	    // Fill in the remainder of the argtuple with Py_Nones
-	    // then destroy it
-	    for (; i < cnt; i++) {
-	      Py_INCREF(Py_None);
-	      PyTuple_SET_ITEM(argtuple, i, Py_None);
-	    }
 	    Py_DECREF(argtuple);
 	    return setPyBadParam(compstatus);
 	  }
 	}
       }
       else {
-	for (i=0,j=4; i < cnt; i++) {
+	for (i=0,j=4; i < cnt; i++,j++) {
 	  name  = PyTuple_GET_ITEM(d_o, j++);
 	  OMNIORB_ASSERT(PyString_Check(name));
 	  value = PyObject_GetAttr(a_o, name);
 
 	  if (value) {
-	    t_o = copyArgument(PyTuple_GET_ITEM(d_o, j++), value, compstatus);
+	    t_o = copyArgument(PyTuple_GET_ITEM(d_o, j), value, compstatus);
 	    if (t_o)
 	      PyTuple_SET_ITEM(argtuple, i, t_o);
 	    Py_DECREF(value);
 	  }
 	  if (!(value && t_o)) {
-	    // Fill in the remainder of the argtuple with Py_Nones
-	    // then destroy it
-	    for (; i < cnt; i++) {
-	      Py_INCREF(Py_None);
-	      PyTuple_SET_ITEM(argtuple, i, Py_None);
-	    }
 	    Py_DECREF(argtuple);
 	    return setPyBadParam(compstatus);
 	  }
@@ -5949,12 +5943,6 @@
 	  PyTuple_SET_ITEM(argtuple, i, t_o);
 	}
 	else {
-	  // Fill in the remainder of the argtuple with Py_Nones
-	  // then destroy it
-	  for (; i < cnt; i++) {
-	    Py_INCREF(Py_None);
-	    PyTuple_SET_ITEM(argtuple, i, Py_None);
-	  }
 	  Py_DECREF(argtuple);
 	  return setPyBadParam(compstatus);
 	}
Index: modules/common/pyTypeCode.cc
===================================================================
RCS file: /cvsroot/omniORBpy/modules/common/pyTypeCode.cc,v
retrieving revision 1.11.2.4
retrieving revision 1.11.2.6
diff -u -u -r1.11.2.4 -r1.11.2.6
--- modules/common/pyTypeCode.cc	2001/01/18 11:52:06	1.11.2.4
+++ modules/common/pyTypeCode.cc	2001/04/09 11:50:00	1.11.2.6
@@ -27,9 +27,15 @@
 // Description:
 //    TypeCode support
 
-// $Id: pyTypeCode.cc,v 1.11.2.4 2001/01/18 11:52:06 dpg1 Exp $
+// $Id: pyTypeCode.cc,v 1.11.2.6 2001/04/09 11:50:00 dpg1 Exp $
 
 // $Log: pyTypeCode.cc,v $
+// Revision 1.11.2.6  2001/04/09 11:50:00  dpg1
+// Forgot to add known enums to offset desctriptor map.
+//
+// Revision 1.11.2.5  2001/03/12 10:20:56  dpg1
+// Suppress annoying compiler warnings about uninitialised variables.
+//
 // Revision 1.11.2.4  2001/01/18 11:52:06  dpg1
 // Silly bug with marshalling TypeCode for CORBA::Object.
 //
@@ -100,18 +106,16 @@
   }
 
   inline void add(PyObject* desc, CORBA::Long offset) {
-    PyObject *desc_o = omniPy::newTwin(desc);
-
-    PyObject* oo = PyInt_FromLong(offset + base_);
+    PyObject* desc_o = omniPy::newTwin(desc);
+    PyObject* oo     = PyInt_FromLong(offset + base_);
     PyDict_SetItem(dict_, desc_o, oo);
     Py_DECREF(desc_o);
     Py_DECREF(oo);
   }
 
   inline CORBA::Boolean lookup(PyObject* desc, CORBA::Long& offset) {
-    PyObject *desc_o = omniPy::newTwin(desc);
-
-    PyObject* oo = PyDict_GetItem(dict_, desc_o);
+    PyObject* desc_o = omniPy::newTwin(desc);
+    PyObject* oo     = PyDict_GetItem(dict_, desc_o);
     Py_DECREF(desc_o);
     if (oo) {
       offset = PyInt_AS_LONG(oo) - base_;
@@ -356,6 +360,8 @@
 #endif
 	default:
 	  OMNIORB_THROW(BAD_TYPECODE, 0, CORBA::COMPLETED_NO);
+	  // Prevent spurious compiler warnings:
+	  dsize = 1; dalign = omni::ALIGN_1;
 	}
 
 	// Default used, count
@@ -1338,7 +1344,7 @@
 PyObject*
 r_unmarshalTypeCode(NetBufferedStream& stream, OffsetDescriptorMap& odm)
 {
-  PyObject* d_o; // Descriptor object to build
+  PyObject* d_o = 0; // Descriptor object to build
   PyObject* t_o;
 
   //  cout << "unmarshal typecode... " << flush;
@@ -1636,6 +1642,7 @@
 	// Static knowledge of the enum
 	Py_INCREF(d_o);
 	Py_DECREF(repoId);
+	odm.add(d_o, tc_offset);
 	//?? Is is worth checking the TypeCodes for equivalence?
       }
       else {
@@ -1881,7 +1888,7 @@
 PyObject*
 r_unmarshalTypeCode(MemBufferedStream& stream, OffsetDescriptorMap& odm)
 {
-  PyObject* d_o; // Descriptor object to build
+  PyObject* d_o = 0; // Descriptor object to build
   PyObject* t_o;
 
   //  cout << "unmarshal typecode... " << flush;
@@ -2179,6 +2186,7 @@
 	// Static knowledge of the enum
 	Py_INCREF(d_o);
 	Py_DECREF(repoId);
+	odm.add(d_o, tc_offset);
 	//?? Is is worth checking the TypeCodes for equivalence?
       }
       else {
Index: modules/omni30/omnipy.cc
===================================================================
RCS file: /cvsroot/omniORBpy/modules/omni30/omnipy.cc,v
retrieving revision 1.37.2.1
retrieving revision 1.37.2.3
diff -u -u -r1.37.2.1 -r1.37.2.3
--- modules/omni30/omnipy.cc	2000/11/02 17:45:42	1.37.2.1
+++ modules/omni30/omnipy.cc	2001/05/01 11:16:42	1.37.2.3
@@ -27,9 +27,16 @@
 // Description:
 //    Main entry points for _omnipy Python module
 
-// $Id: omnipy.cc,v 1.37.2.1 2000/11/02 17:45:42 dpg1 Exp $
+// $Id: omnipy.cc,v 1.37.2.3 2001/05/01 11:16:42 dpg1 Exp $
 
 // $Log: omnipy.cc,v $
+// Revision 1.37.2.3  2001/05/01 11:16:42  dpg1
+// omnipy_narrow() called createObjRef() while holding the interpreter
+// lock.
+//
+// Revision 1.37.2.2  2001/04/09 16:32:23  dpg1
+// De-uglify ORB_init command line argument eating.
+//
 // Revision 1.37.2.1  2000/11/02 17:45:42  dpg1
 // Unnecessary extra call to _is_a() after narrow()
 //
@@ -435,27 +442,27 @@
 
     omniPy::orb = orb;
 
-    // This is extremely horrid -- modify the Python list in place to
-    // reflect the changed argv. This leaks PyStringObjects, but they
-    // would have hung around for the program's life time anyway...
+    // Remove eaten arguments from Python argv list
     if (argc < orig_argc) {
-      int j;
+      int r;
       char *s, *t;
-      for (i=0, j=0; i<argc; i++, j++) {
+      for (i=0; i<argc; ++i) {
 	s = argv[i];
 
 	while (1) {
-	  o = PyList_GET_ITEM(pyargv, j);
+	  o = PyList_GetItem(pyargv, i); OMNIORB_ASSERT(o != 0);
 	  t = PyString_AS_STRING(o);
 	  if (s == t) break;
-	  j++;
-	  OMNIORB_ASSERT(j < orig_argc);
+	  r = PySequence_DelItem(pyargv, i);
+	  OMNIORB_ASSERT(r != -1);
 	}
-	PyList_SET_ITEM(pyargv, i, o);
       }
-      ((PyListObject*)pyargv)->ob_size = argc;
+      while (PyList_Size(pyargv) > argc) {
+	// Delete -ORB arguments at end
+	r = PySequence_DelItem(pyargv, i);
+	OMNIORB_ASSERT(r != -1);
+      }
     }
-
     delete [] argv;
 
     omniPy::setTwin(pyorb, orb, ORB_TWIN);
@@ -736,22 +743,27 @@
 
     RAISE_PY_BAD_PARAM_IF(!cxxsource);
 
-    CORBA::Boolean isa;
+    CORBA::Boolean    isa;
+    CORBA::Object_ptr cxxdest;
+
     try {
       omniPy::InterpreterUnlocker ul;
       isa = cxxsource->_is_a(repoId);
+
+      if (isa) {
+	omniObjRef* oosource = cxxsource->_PR_getobj();
+	omniObjRef* oodest =
+	  omniPy::createObjRef(oosource->_mostDerivedRepoId(),
+			       repoId,
+			       oosource->_iopProfiles(),
+			       0, 1);
+	cxxdest =
+	  (CORBA::Object_ptr)(oodest->_ptrToObjRef(CORBA::Object::_PD_repoId));
+      }
     }
     OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS
 
     if (isa) {
-      omniObjRef* oosource = cxxsource->_PR_getobj();
-      omniObjRef* oodest = omniPy::createObjRef(oosource->_mostDerivedRepoId(),
-						repoId,
-						oosource->_iopProfiles(),
-						0, 1);
-      CORBA::Object_ptr cxxdest =
-	(CORBA::Object_ptr)(oodest->_ptrToObjRef(CORBA::Object::_PD_repoId));
-
       return omniPy::createPyCorbaObjRef(repoId, cxxdest);
     }
     else {
Index: modules/omni30/pyORBFunc.cc
===================================================================
RCS file: /cvsroot/omniORBpy/modules/omni30/pyORBFunc.cc,v
retrieving revision 1.7.2.2
retrieving revision 1.7.2.3
diff -u -u -r1.7.2.2 -r1.7.2.3
--- modules/omni30/pyORBFunc.cc	2000/11/29 17:11:18	1.7.2.2
+++ modules/omni30/pyORBFunc.cc	2001/03/12 10:20:00	1.7.2.3
@@ -27,9 +27,12 @@
 // Description:
 //    ORB functions
 
-// $Id: pyORBFunc.cc,v 1.7.2.2 2000/11/29 17:11:18 dpg1 Exp $
+// $Id: pyORBFunc.cc,v 1.7.2.3 2001/03/12 10:20:00 dpg1 Exp $
 
 // $Log: pyORBFunc.cc,v $
+// Revision 1.7.2.3  2001/03/12 10:20:00  dpg1
+// Missing try around object_to_string()
+//
 // Revision 1.7.2.2  2000/11/29 17:11:18  dpg1
 // Fix deadlock when trying to lock omniORB internal lock while holding
 // the Python interpreter lock.
@@ -125,10 +128,11 @@
     RAISE_PY_BAD_PARAM_IF(!objref);
 
     CORBA::String_var str;
-    {
+    try {
       omniPy::InterpreterUnlocker _u;
       str = orb->object_to_string(objref);
     }
+    OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS
     return PyString_FromString((char*)str);
   }
 
Index: modules/omni30/pyObjectRef.cc
===================================================================
RCS file: /cvsroot/omniORBpy/modules/omni30/pyObjectRef.cc,v
retrieving revision 1.17.2.3
retrieving revision 1.17.2.4
diff -u -u -r1.17.2.3 -r1.17.2.4
--- modules/omni30/pyObjectRef.cc	2001/02/14 15:22:20	1.17.2.3
+++ modules/omni30/pyObjectRef.cc	2001/05/03 15:25:02	1.17.2.4
@@ -28,8 +28,13 @@
 //    Versions of ORB object ref functions which deal with Python
 //    objects, rather than C++ objects
 
-// $Id: pyObjectRef.cc,v 1.17.2.3 2001/02/14 15:22:20 dpg1 Exp $
+// $Id: pyObjectRef.cc,v 1.17.2.4 2001/05/03 15:25:02 dpg1 Exp $
 // $Log: pyObjectRef.cc,v $
+// Revision 1.17.2.4  2001/05/03 15:25:02  dpg1
+// Various places released object references while holding the
+// interpreter lock. Object reference deletion locks omni::internalLock,
+// so this could cause deadlocks against Servant::_add_ref().
+//
 // Revision 1.17.2.3  2001/02/14 15:22:20  dpg1
 // Fix bug using repoId strings after deletion.
 //
@@ -578,8 +583,8 @@
 				  CORBA::Object::_PD_repoId,
 				  cxxobjref->_iopProfiles(),
 				  0, 0);
+    CORBA::release(cxxobj);
   }
-  CORBA::release(cxxobj);
   return (CORBA::Object_ptr)objref->_ptrToObjRef(CORBA::Object::_PD_repoId);
 }
 
Index: modules/omni30/pyPOAFunc.cc
===================================================================
RCS file: /cvsroot/omniORBpy/modules/omni30/pyPOAFunc.cc,v
retrieving revision 1.12.2.3
retrieving revision 1.12.2.4
diff -u -u -r1.12.2.3 -r1.12.2.4
--- modules/omni30/pyPOAFunc.cc	2001/02/14 15:22:20	1.12.2.3
+++ modules/omni30/pyPOAFunc.cc	2001/05/03 15:25:02	1.12.2.4
@@ -27,8 +27,13 @@
 // Description:
 //    POA functions
 
-// $Id: pyPOAFunc.cc,v 1.12.2.3 2001/02/14 15:22:20 dpg1 Exp $
+// $Id: pyPOAFunc.cc,v 1.12.2.4 2001/05/03 15:25:02 dpg1 Exp $
 // $Log: pyPOAFunc.cc,v $
+// Revision 1.12.2.4  2001/05/03 15:25:02  dpg1
+// Various places released object references while holding the
+// interpreter lock. Object reference deletion locks omni::internalLock,
+// so this could cause deadlocks against Servant::_add_ref().
+//
 // Revision 1.12.2.3  2001/02/14 15:22:20  dpg1
 // Fix bug using repoId strings after deletion.
 //
@@ -88,8 +93,7 @@
 public:
   PYOSReleaseHelper(omniPy::Py_omniServant* pyos) : pyos_(pyos) {}
   ~PYOSReleaseHelper() {
-    omniPy::InterpreterUnlocker _u;
-    pyos_->_remove_ref();
+    pyos_->_locked_remove_ref();
   }
 private:
   omniPy::Py_omniServant* pyos_;
@@ -409,22 +413,29 @@
     OMNIORB_ASSERT(poa);
 
     try {
-      PortableServer::AdapterActivator_var act = poa->the_activator();
-
-      if (CORBA::is_nil(act)) {
-	Py_INCREF(Py_None);
-	return Py_None;
-      }
-      else {
-	CORBA::Object_ptr lobjref;
-	const char* repoId;
+      CORBA::Object_ptr lobjref;
+      const char*       repoId;
+      {
+	omniPy::InterpreterUnlocker _u;
 	{
-	  omniPy::InterpreterUnlocker _u;
-	  repoId  = act->_PR_getobj()->_mostDerivedRepoId();
-	  lobjref = omniPy::makeLocalObjRef(repoId, act);
+	  PortableServer::AdapterActivator_var act = poa->the_activator();
+
+	  if (CORBA::is_nil(act)) {
+	    lobjref = 0;
+	  }
+	  else {
+	    repoId  = act->_PR_getobj()->_mostDerivedRepoId();
+	    lobjref = omniPy::makeLocalObjRef(repoId, act);
+	  }
 	}
+      }
+      if (lobjref) {
 	return omniPy::createPyCorbaObjRef(0, lobjref);
       }
+      else {
+	Py_INCREF(Py_None);
+	return Py_None;
+      }
     }
     OMNIPY_CATCH_AND_HANDLE_SYSTEM_EXCEPTIONS
   }
@@ -468,22 +479,29 @@
     OMNIORB_ASSERT(poa);
 
     try {
-      PortableServer::ServantManager_var sm = poa->get_servant_manager();
-
-      if (CORBA::is_nil(sm)) {
-	Py_INCREF(Py_None);
-	return Py_None;
-      }
-      else {
-	CORBA::Object_ptr lobjref;
-	const char*       repoId;
+      CORBA::Object_ptr lobjref;
+      const char*       repoId;
+      {
+	omniPy::InterpreterUnlocker _u;
 	{
-	  omniPy::InterpreterUnlocker _u;
-	  repoId  = sm->_PR_getobj()->_mostDerivedRepoId();
-	  lobjref = omniPy::makeLocalObjRef(repoId, sm);
+	  PortableServer::ServantManager_var sm = poa->get_servant_manager();
+
+	  if (CORBA::is_nil(sm)) {
+	    lobjref = 0;
+	  }
+	  else {
+	    repoId  = sm->_PR_getobj()->_mostDerivedRepoId();
+	    lobjref = omniPy::makeLocalObjRef(repoId, sm);
+	  }
 	}
+      }
+      if (lobjref) {
 	return omniPy::createPyCorbaObjRef(0, lobjref);
       }
+      else {
+	Py_INCREF(Py_None);
+	return Py_None;
+      }
     }
     catch (PortableServer::POA::WrongPolicy& ex) {
       return raisePOAException(pyPOA, "WrongPolicy");
@@ -714,12 +732,14 @@
     OMNIORB_ASSERT(poa);
 
     try {
-      CORBA::Object_var objref;
       CORBA::Object_ptr lobjref;
       {
 	omniPy::InterpreterUnlocker _u;
-	objref  = poa->create_reference(repoId);
-	lobjref = omniPy::makeLocalObjRef(repoId, objref);
+	{
+	  CORBA::Object_var objref;
+	  objref  = poa->create_reference(repoId);
+	  lobjref = omniPy::makeLocalObjRef(repoId, objref);
+	}
       }
       return omniPy::createPyCorbaObjRef(repoId, lobjref);
     }
@@ -747,12 +767,14 @@
 
     try {
       PortableServer::ObjectId oid(oidlen, oidlen, (CORBA::Octet*)oidstr, 0);
-      CORBA::Object_var objref;
       CORBA::Object_ptr lobjref;
       {
 	omniPy::InterpreterUnlocker _u;
-	objref  = poa->create_reference_with_id(oid, repoId);
-	lobjref = omniPy::makeLocalObjRef(repoId, objref);
+	{
+	  CORBA::Object_var objref;
+	  objref  = poa->create_reference_with_id(oid, repoId);
+	  lobjref = omniPy::makeLocalObjRef(repoId, objref);
+	}
       }
       return omniPy::createPyCorbaObjRef(repoId, lobjref);
     }
@@ -811,12 +833,14 @@
     PYOSReleaseHelper _r(pyos);
 
     try {
-      CORBA::Object_var objref;
       CORBA::Object_ptr lobjref;
       {
 	omniPy::InterpreterUnlocker _u;
-	objref  = poa->servant_to_reference(pyos);
-	lobjref = omniPy::makeLocalObjRef(pyos->_mostDerivedRepoId(), objref);
+	{
+	  CORBA::Object_var objref;
+	  objref  = poa->servant_to_reference(pyos);
+	  lobjref = omniPy::makeLocalObjRef(pyos->_mostDerivedRepoId(),objref);
+	}
       }
       return omniPy::createPyCorbaObjRef(pyos->_mostDerivedRepoId(), lobjref);
     }
@@ -983,14 +1007,16 @@
 
     try {
       PortableServer::ObjectId oid(oidlen, oidlen, (CORBA::Octet*)oidstr, 0);
-      CORBA::Object_var objref;
       CORBA::Object_ptr lobjref;
       const char* mdri;
       {
 	omniPy::InterpreterUnlocker _u;
-	objref  = poa->id_to_reference(oid);
-	mdri    = objref->_PR_getobj()->_mostDerivedRepoId();
-	lobjref = omniPy::makeLocalObjRef(mdri, objref);
+	{
+	  CORBA::Object_var objref;
+	  objref  = poa->id_to_reference(oid);
+	  mdri    = objref->_PR_getobj()->_mostDerivedRepoId();
+	  lobjref = omniPy::makeLocalObjRef(mdri, objref);
+	}
       }
       return omniPy::createPyCorbaObjRef(0, lobjref);
     }
Index: modules/omni30/pyServant.cc
===================================================================
RCS file: /cvsroot/omniORBpy/modules/omni30/pyServant.cc,v
retrieving revision 1.24.2.6
retrieving revision 1.24.2.7
diff -u -u -r1.24.2.6 -r1.24.2.7
--- modules/omni30/pyServant.cc	2001/02/14 15:22:20	1.24.2.6
+++ modules/omni30/pyServant.cc	2001/05/03 15:25:03	1.24.2.7
@@ -27,9 +27,14 @@
 // Description:
 //    Implementation of Python servant object
 
-// $Id: pyServant.cc,v 1.24.2.6 2001/02/14 15:22:20 dpg1 Exp $
+// $Id: pyServant.cc,v 1.24.2.7 2001/05/03 15:25:03 dpg1 Exp $
 
 // $Log: pyServant.cc,v $
+// Revision 1.24.2.7  2001/05/03 15:25:03  dpg1
+// Various places released object references while holding the
+// interpreter lock. Object reference deletion locks omni::internalLock,
+// so this could cause deadlocks against Servant::_add_ref().
+//
 // Revision 1.24.2.6  2001/02/14 15:22:20  dpg1
 // Fix bug using repoId strings after deletion.
 //
@@ -388,12 +393,14 @@
 omniPy::
 Py_omniServant::py_this()
 {
-  CORBA::Object_var objref;
   CORBA::Object_ptr lobjref;
   {
     omniPy::InterpreterUnlocker _u;
-    objref  = (CORBA::Object_ptr)_do_this(CORBA::Object::_PD_repoId);
-    lobjref = omniPy::makeLocalObjRef(repoId_, objref);
+    {
+      CORBA::Object_var objref;
+      objref  = (CORBA::Object_ptr)_do_this(CORBA::Object::_PD_repoId);
+      lobjref = omniPy::makeLocalObjRef(repoId_, objref);
+    }
   }
   return omniPy::createPyCorbaObjRef(repoId_, lobjref);
 }
Index: omniidl_be/python.py
===================================================================
RCS file: /cvsroot/omniORBpy/omniidl_be/python.py,v
retrieving revision 1.27.2.4
retrieving revision 1.27.2.8
diff -u -u -r1.27.2.4 -r1.27.2.8
--- omniidl_be/python.py	2000/11/01 11:25:56	1.27.2.4
+++ omniidl_be/python.py	2001/06/12 10:56:01	1.27.2.8
@@ -26,8 +26,21 @@
 #   
 #   Back-end for Python
 
-# $Id: python.py,v 1.27.2.4 2000/11/01 11:25:56 dpg1 Exp $
+# $Id: python.py,v 1.27.2.8 2001/06/12 10:56:01 dpg1 Exp $
 # $Log: python.py,v $
+# Revision 1.27.2.8  2001/06/12 10:56:01  dpg1
+# Scoping bug in stub code.
+#
+# Revision 1.27.2.7  2001/05/18 14:30:53  dpg1
+# Python long int constants fail on Python 2.x.
+#
+# Revision 1.27.2.6  2001/04/23 13:53:08  dpg1
+# Cosmetic output change.
+#
+# Revision 1.27.2.5  2001/03/19 12:01:24  dpg1
+# Invalid stub code generated for typedef to struct/union inside an
+# interface.
+#
 # Revision 1.27.2.4  2000/11/01 11:25:56  dpg1
 # Recursive structs inside interfaces were broken
 #
@@ -179,7 +192,7 @@
 """
 
 file_end = """\
-_exported_modules = ( @export_string@, )
+_exported_modules = ( @export_string@)
 
 # The end."""
 
@@ -204,7 +217,7 @@
 import @ifilename@"""
 
 open_imported_module_name = """\
-_0_@imodname@     = omniORB.openModule("@package@@imodname@")
+_0_@imodname@ = omniORB.openModule("@package@@imodname@")
 _0_@s_imodname@ = omniORB.openModule("@package@@s_imodname@")"""
 
 forward_interface = """\
@@ -217,6 +230,7 @@
 
 # interface @ifid@
 _0_@modname@._d_@ifid@ = (omniORB.tcInternal.tv_objref, "@repoId@", "@ifid@")
+_0_@modname@.@ifid@ = omniORB.newEmptyClass()
 class @ifid@ @inherits@:
     _NP_RepositoryId = _0_@modname@._d_@ifid@[1]
 
@@ -342,10 +356,12 @@
 
 recursive_struct_descr = """
 # Recursive struct @sname@
-_d_@sname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"])"""
+_d_@sname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"])
+_0_@scope@._d_@sname@ = _d_@sname@"""
 
 struct_class = """
 # struct @sname@
+_0_@scopedname@ = omniORB.newEmptyClass()
 class @sname@:
     _NP_RepositoryId = "@repoId@"
 """
@@ -371,7 +387,7 @@
 
 struct_descriptor = """\
 
-_d_@sname@  = (omniORB.tcInternal.tv_struct, @sname@, @sname@._NP_RepositoryId, "@sname@"@mdescs@)"""
+_d_@sname@  = _0_@scope@._d_@sname@ = (omniORB.tcInternal.tv_struct, @sname@, @sname@._NP_RepositoryId, "@sname@"@mdescs@)"""
 
 struct_indirect = """\
 omniORB.tcInternal.insertIndirections(_d_@sname@)"""
@@ -388,6 +404,7 @@
 exception_class = """\
 
 # exception @sname@
+_0_@scopedname@ = omniORB.newEmptyClass()
 class @sname@ (CORBA.UserException):
     _NP_RepositoryId = "@repoId@"
 """
@@ -420,10 +437,12 @@
 
 recursive_union_descr = """
 # Recursive union @uname@
-_d_@uname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"])"""
+_d_@uname@ = (omniORB.tcInternal.tv__indirect, ["@repoId@"])
+_0_@scope@._d_@uname@ = _d_@uname@"""
 
 union_class = """
 # union @uname@
+_0_@scopedname@ = omniORB.newEmptyClass()
 class @uname@ (omniORB.Union):
     _NP_RepositoryId = "@repoId@"\
 """
@@ -454,7 +473,7 @@
 @uname@._def_d  = @def_d@
 
 _m_@uname@  = (@m_un@,)
-_d_@uname@  = (omniORB.tcInternal.tv_union, @uname@, @uname@._NP_RepositoryId, "@uname@", @stype@, @defpos@, _m_@uname@, @m_def@, {@d_map@})"""
+_d_@uname@  = _0_@scope@._d_@uname@ = (omniORB.tcInternal.tv_union, @uname@, @uname@._NP_RepositoryId, "@uname@", @stype@, @defpos@, _m_@uname@, @m_def@, {@d_map@})"""
 
 union_indirect = """\
 omniORB.tcInternal.insertIndirections(_d_@uname@)"""
@@ -578,6 +597,7 @@
     exports = exported_modules.keys()
     exports.sort()
     export_list   = map(lambda s: '"' + module_package + s + '"', exports)
+    if len(export_list) == 1: export_list.append("")
     export_string = string.join(export_list, ", ")
 
     st.out(file_end, export_string=export_string)
@@ -994,8 +1014,19 @@
                    unaliased_type.kind() in [idltype.tk_struct,
                                              idltype.tk_union]:
 
-                    parent = dotName(fixupScopedName(unaliased_type.decl().\
-                                                     scopedName()))
+                    psname  = unaliased_type.decl().scopedName()
+                    myscope = decl.scopedName()[:-1]
+
+                    # If the struct/union definition is in the same
+                    # scope as the typedef, we must use a relative
+                    # name to refer to the parent class, since the
+                    # enclosing Python class has not yet been fully
+                    # defined.
+
+                    if psname[:len(myscope)] == myscope:
+                        parent = dotName(psname[len(myscope):])
+                    else:
+                        parent = dotName(fixupScopedName(psname))
 
                     self.st.out(typedef_struct_union_header,
                                 tdname = tdname,
@@ -1018,6 +1049,8 @@
 
         sname = mangle(node.identifier())
 
+        fscopedName = fixupScopedName(node.scopedName(), "")
+
         if node.recursive():
             if self.at_module_scope:
                 self.st.out(recursive_struct_descr_at_module_scope,
@@ -1028,9 +1061,12 @@
                 self.st.out(recursive_struct_descr,
                             sname   = sname,
                             repoId  = node.repoId(),
-                            modname = self.modname)
+                            scope   = dotName(fscopedName[:-1]))
 
-        self.st.out(struct_class, sname = sname, repoId = node.repoId())
+        self.st.out(struct_class,
+                    sname      = sname,
+                    repoId     = node.repoId(),
+                    scopedname = dotName(fscopedName))
 
         mnamel = []
         mdescl = []
@@ -1092,9 +1128,14 @@
                         sname   = sname,
                         modname = self.modname)
         else:
-            self.st.out(struct_descriptor, sname = sname, mdescs = mdescs)
+            self.st.out(struct_descriptor,
+                        sname  = sname,
+                        mdescs = mdescs,
+                        scope  = dotName(fscopedName[:-1]))
+
             if node.recursive():
                 self.st.out(struct_indirect, sname = sname)
+
             self.st.out(struct_register, sname = sname)
 
     #
@@ -1104,7 +1145,11 @@
         if self.handleImported(node): return
 
         sname = mangle(node.identifier())
-        self.st.out(exception_class, sname = sname, repoId = node.repoId())
+        fscopedName = fixupScopedName(node.scopedName(), "")
+        self.st.out(exception_class,
+                    sname = sname,
+                    repoId = node.repoId(),
+                    scopedname = dotName(fscopedName))
 
         mnamel = []
         mdescl = []
@@ -1169,6 +1214,8 @@
         else:
             stype = typeToDescriptor(node.switchType(), self.currentScope)
 
+        fscopedName = fixupScopedName(node.scopedName(), "")
+        
         if node.recursive():
             if self.at_module_scope:
                 self.st.out(recursive_union_descr_at_module_scope,
@@ -1176,12 +1223,16 @@
                             repoId  = node.repoId(),
                             modname = self.modname)
             else:
+                scopedName = node.scopedName()
                 self.st.out(recursive_union_descr,
                             uname   = uname,
                             repoId  = node.repoId(),
-                            modname = self.modname)
+                            scope   = dotName(fscopedName[:-1]))
 
-        self.st.out(union_class, uname=uname, repoId=node.repoId())
+        self.st.out(union_class,
+                    uname      = uname,
+                    repoId     = node.repoId(),
+                    scopedname = dotName(fscopedName))
 
         if node.constrType():
             self.st.inc_indent()
@@ -1310,7 +1361,8 @@
                         stype   = stype,
                         defpos  = defpos,
                         m_def   = m_def,
-                        d_map   = d_map)
+                        d_map   = d_map,
+                        scope   = dotName(fscopedName[:-1]))
             
             if node.recursive():
                 self.st.out(union_indirect, uname = uname)
@@ -1572,6 +1624,10 @@
 
     elif kind == idltype.tk_long and val == -2147483647 - 1:
         return "-2147483647 - 1"
+
+    elif type(val) is type(1L):
+        return repr(val)
+
     else:
         return str(val)
 
Index: python/omniORB/CORBA.py
===================================================================
RCS file: /cvsroot/omniORBpy/python/omniORB/CORBA.py,v
retrieving revision 1.27.2.2
retrieving revision 1.27.2.3
diff -u -u -r1.27.2.2 -r1.27.2.3
--- python/omniORB/CORBA.py	2000/08/17 08:46:06	1.27.2.2
+++ python/omniORB/CORBA.py	2001/05/17 14:05:01	1.27.2.3
@@ -28,9 +28,12 @@
 #    Definitions for CORBA module
 
 
-# $Id: CORBA.py,v 1.27.2.2 2000/08/17 08:46:06 dpg1 Exp $
+# $Id: CORBA.py,v 1.27.2.3 2001/05/17 14:05:01 dpg1 Exp $
 
 # $Log: CORBA.py,v $
+# Revision 1.27.2.3  2001/05/17 14:05:01  dpg1
+# Implement _get_interface()
+#
 # Revision 1.27.2.2  2000/08/17 08:46:06  dpg1
 # Support for omniORB.LOCATION_FORWARD exception
 #
@@ -592,8 +595,18 @@
         o.__del__ = dummy
 
     def _get_interface(self):
-        # ***
-        raise NO_IMPLEMENT()
+        import omniORB
+        if omniORB.orb is None:
+            raise BAD_INV_ORDER(0, COMPLETED_NO)
+
+        import omniORB.ir_idl # Make sure IR stubs are loaded
+
+        ir = omniORB.orb.resolve_initial_references("InterfaceRepository")
+        ir = ir._narrow(Repository)
+        if ir is None:
+            raise INTF_REPOS(0, COMPLETED_NO)
+        interf = ir.lookup_id(self._NP_RepositoryId)
+        return interf._narrow(InterfaceDef)
     
     def _is_a(self, repoId):
         return _omnipy.isA(self, repoId)
Index: python/omniORB/__init__.py
===================================================================
RCS file: /cvsroot/omniORBpy/python/omniORB/__init__.py,v
retrieving revision 1.24.2.2
retrieving revision 1.24.2.4
diff -u -u -r1.24.2.2 -r1.24.2.4
--- python/omniORB/__init__.py	2000/08/23 09:22:07	1.24.2.2
+++ python/omniORB/__init__.py	2001/06/12 10:56:02	1.24.2.4
@@ -28,9 +28,15 @@
 #    omniORB module -- omniORB specific things
 
 
-# $Id: __init__.py,v 1.24.2.2 2000/08/23 09:22:07 dpg1 Exp $
+# $Id: __init__.py,v 1.24.2.4 2001/06/12 10:56:02 dpg1 Exp $
 
 # $Log: __init__.py,v $
+# Revision 1.24.2.4  2001/06/12 10:56:02  dpg1
+# Scoping bug in stub code.
+#
+# Revision 1.24.2.3  2001/04/10 16:33:41  dpg1
+# Minor bugs in Any coercion.
+#
 # Revision 1.24.2.2  2000/08/23 09:22:07  dpg1
 # Fix loading of IfR stubs with "import CORBA"
 #
@@ -373,6 +379,11 @@
 
     return mod
 
+# Function to create a new empty class as a scope place-holder
+def newEmptyClass():
+    class __dummy: pass
+    return __dummy
+
 
 # Classes to support IDL type mapping
 
@@ -556,7 +567,7 @@
 
     try:
         if fd == td:
-            return a._v
+            return v
 
         elif fd[0] == tcInternal.tv_objref:
             return _omnipy.narrow(v, td[1])
@@ -571,7 +582,7 @@
             return apply(td[1], l)
 
         elif fd[0] == tcInternal.tv_union:
-            return td[1](v._d, coerceAny(v._v, fd[6][v._d], tf[6][v._d]))
+            return td[1](v._d, coerceAny(v._v, fd[6][v._d], td[6][v._d]))
 
         elif fd[0] == tcInternal.tv_enum:
             return td[3][v._v]
Index: python/omniORB/tcInternal.py
===================================================================
RCS file: /cvsroot/omniORBpy/python/omniORB/tcInternal.py,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.3
diff -u -u -r1.9.2.1 -r1.9.2.3
--- python/omniORB/tcInternal.py	2000/08/07 09:19:24	1.9.2.1
+++ python/omniORB/tcInternal.py	2001/05/14 14:21:15	1.9.2.3
@@ -27,10 +27,16 @@
 # Description:
 #    TypeCode internal implementation
 
+# $Id: tcInternal.py,v 1.9.2.3 2001/05/14 14:21:15 dpg1 Exp $
 
-# $Id: tcInternal.py,v 1.9.2.1 2000/08/07 09:19:24 dpg1 Exp $
-
 # $Log: tcInternal.py,v $
+# Revision 1.9.2.3  2001/05/14 14:21:15  dpg1
+# TypeCode.equivalent() was broken in a similar manner to
+# get_compact_typecode()
+#
+# Revision 1.9.2.2  2001/05/11 16:27:23  dpg1
+# TypeCode.get_compact_typecode() was broken.
+#
 # Revision 1.9.2.1  2000/08/07 09:19:24  dpg1
 # Long long support
 #
@@ -436,7 +442,7 @@
         return equivalentDescriptors(self._d, tc._d)
 
     def get_compact_typecode(self):
-        return TypeCode_struct(getCompactDescriptor(self._d))
+        return TypeCode_struct(getCompactDescriptor(self._d), None)
 
     def id(self):                 return self._d[2]
     def name(self):               return self._d[3]
@@ -472,7 +478,7 @@
         return equivalentDescriptors(self._d, tc._d)
 
     def get_compact_typecode(self):
-        return TypeCode_union(getCompactDescriptor(self._d))
+        return TypeCode_union(getCompactDescriptor(self._d), None)
 
     def id(self):                  return self._d[2]
     def name(self):                return self._d[3]
@@ -541,7 +547,7 @@
         return equivalentDescriptors(self._d, tc._d)
 
     def get_compact_typecode(self):
-        return TypeCode_sequence(getCompactDescriptor(self._d))
+        return TypeCode_sequence(getCompactDescriptor(self._d), None)
 
     def length(self):       return self._d[2]
     def content_type(self):
@@ -568,7 +574,7 @@
         return equivalentDescriptors(self._d, tc._d)
 
     def get_compact_typecode(self):
-        return TypeCode_sequence(getCompactDescriptor(self._d))
+        return TypeCode_sequence(getCompactDescriptor(self._d), None)
 
     def length(self):       return self._d[2]
     def content_type(self): return createTypeCode(self._d[1])
@@ -591,7 +597,7 @@
         return equivalentDescriptors(self._d, tc._d)
 
     def get_compact_typecode(self):
-        return TypeCode_alias(getCompactDescriptor(self._d))
+        return TypeCode_alias(getCompactDescriptor(self._d), None)
 
     def id(self):           return self._d[1]
     def name(self):         return self._d[2]
@@ -615,7 +621,7 @@
         return equivalentDescriptors(self._d, tc._d)
 
     def get_compact_typecode(self):
-        return TypeCode_except(getCompactDescriptor(self._d))
+        return TypeCode_except(getCompactDescriptor(self._d), None)
 
     def id(self):                 return self._d[2]
     def name(self):               return self._d[3]
@@ -635,29 +641,39 @@
 
 
 # Functions to test descriptor equivalent
-def equivalentDescriptors(a, b, seen={}):
+def equivalentDescriptors(a, b, seen=None):
 
-    try:
+    if seen is None: seen = {}
 
-        if seen.has_key(id(a)): return 1
-        if a == b:              return 1
+    try:
+        if a == b: return 1
 
         # If they don't trivially match, they must be tuples:
         if type(a) is not types.TupleType or type(b) is not types.TupleType:
             return 0
 
-        while a[0] == tv_alias:
-            a = a[3]
+        # Follow aliases and indirections
+        while a[0] == tv_alias or a[0] == tv__indirect:
+            if a[0] == tv_alias:
+                a = a[3]
+            else:
+                a = a[1][0]
+
+        while b[0] == tv_alias or b[0] == tv__indirect:
+            if b[0] == tv_alias:
+                b = b[3]
+            else:
+                b = b[1][0]
 
-        while b[0] == tv_alias:
-            b = b[3]
+        if seen.has_key((id(a),id(b))):
+            return 1
+
+        seen[id(a),id(b)] = None
 
         # Must be same kind
         if a[0] != b[0]:
             return 0
 
-        seen[id(a)] = 1
-
         if a[0] == tv_struct:
             # id
             if a[2] != "" and b[2] != "":
@@ -667,11 +683,14 @@
                     return 0
 
             # members:
-            for i in range(4, len(a), 2):
+            if len(a) != len(b):
+                return 0
             
+            for i in range(4, len(a), 2):
                 # Member type
                 if not equivalentDescriptors(a[i+1], b[i+1], seen):
                     return 0
+
             return 1
 
         elif a[0] == tv_union:
@@ -744,15 +763,15 @@
                     return 0
 
                 # members:
-                for i in range(4, len(self._d), 2):
+                if len(a) != len(b):
+                    return 0
 
+                for i in range(4, len(self._d), 2):
                     # Member type
                     if not equivalentDescriptors(a[i+1], b[i+1], seen):
                         return 0
-            return 1
 
-        elif a[0] == tv__indirect:
-            return equivalentDescriptors(a[1][0], b[1][0], seen)
+            return 1
 
         return 0
 
@@ -801,7 +820,6 @@
     
     elif k == tv_struct:
         c = list(d)
-        c[2] = ""
         c[3] = ""
         for i in range(4, len(c), 2):
             c[i]   = ""
@@ -811,7 +829,6 @@
     
     elif k == tv_union:
         c = list(d)
-        c[2] = ""
         c[3] = ""
         c[4] = r_getCompactDescriptor(d[4], seen, ind)
 
@@ -830,7 +847,7 @@
         m = []
         for e in d[3]:
             m.append(omniORB.AnonymousEnumItem(e._v))
-        r = (k, "", "", tuple(m))
+        r = (k, d[1], "", tuple(m))
 
     elif k == tv_sequence:
         r = (k, r_getCompactDescriptor(d[1], seen, ind), d[2])
@@ -839,7 +856,7 @@
         r = (k, r_getCompactDescriptor(d[1], seen, ind), d[2])
 
     elif k == tv_alias:
-        r = (k, "", "", r_getCompactDescriptor(d[3], seen, ind))
+        r = (k, d[1], "", r_getCompactDescriptor(d[3], seen, ind))
 
     elif k == tv_except:
         c = list(d)
