[omniORB-dev] [PATCH] omniORBpy: allow "from <parents> import <module>" after partial module loading

Fabian Knittel fabian.knittel at fsmi.uni-karlsruhe.de
Thu Oct 4 04:16:21 BST 2007


[ Resent without signature, as mailman broke it (reformatted a few MIME
  headers) and the archive software apparently doesn't display the
  contents of signed mails. Sorry for the noise. ]

Hello everyone,

I assume to have found a minor bug in omniORBpy and hope that this list
is the right place for this kind of mail...

Please, assume the following setup:

 - two IDL files (A1.idl and A2.idl) contribute to the same CORBA
   module A

 - the CORBA module B #includes only e.g. A1.idl

 - omniidl is used with -Wbpackage=P or modules A and B are
   sub-modules beneath module P (I only tested the former, not the
   latter case though)

And now, consider the following python code:

    1: import P.B
    2: from P import A

At this point, A only contains the definitions from P/A1_idl.py.
P/A/__init__.py is never called. This is because, after line 1, P
already contains an attribute A, referencing the partial module and
"from ... import ..." in line 2 uses that attribute instead of loading
the actual module. ("import P.A" works -- probably because it doesn't
look at P's attributes.)

As P.A is still a _partial_ module right after line 1, IMHO it shouldn't
be published in P yet.

As far as I can tell, omniORB internally always uses fully qualified
access going through omniORB.openModule() and doesn't depend on the
above mentioned publishing of partial modules. Normal users depending on
this would be buggy as well, as they should be loading the desired
module themselves (and should therefore never be accessing a partial
module directly anyway).

So, in conclusion, my approach is to no longer publish partially loaded
modules in their parent modules (i.e. not add an attribute pointing to
the partially loaded child module to the parent module). AFAICT, this
circumvents all problems and removes no features.

I've attached a patch containing this one-line change to
omniORB.updateModule() and a tar-ball with a Makefile reproducing the
problem.

Cheers, Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: omniORBpy-fix-updateModule.patch
Type: text/x-patch
Size: 421 bytes
Desc: not available
Url : http://www.omniorb-support.com/pipermail/omniorb-dev/attachments/20071004/5d7a06b6/omniORBpy-fix-updateModule.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: omniORBpy-fix-updateModule_test-case.tar.gz
Type: application/x-gzip
Size: 878 bytes
Desc: not available
Url : http://www.omniorb-support.com/pipermail/omniorb-dev/attachments/20071004/5d7a06b6/omniORBpy-fix-updateModule_test-case.tar.bin


More information about the omniORB-dev mailing list