[C++-sig] Pyste: problems with inheritance across headers.

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Tue Jul 8 10:56:47 CEST 2003


I found a few more serious bugs with Pyste.  I split up a simple class
hierarchy over several header files and also made different pyste
files to wrap these.  Pyste has difficulty with executing the module
functions in the right order (as I suspected in an earlier post) and
also has difficulties with the base classes.  The trouble being that
the exported_names are grouped by headers and only the exported names
grouped by header are known when generating the code for a class.  So
if a base class is in another header the bases will not be correctly
set leading to problems.

Possible resolution for this problem:

 1. Compute all the exported names in one go and then use that
    information when generating the code.

 2. Additionally, do not use grouping by headers to order the writes.
    A more sophisticated approach is needed to get the right sequence
    of module initialization.

 3. Assume that all bases are exported by default instead of relying
    on exported_names.  I guess this is not an option. :(

The necessity of the exported_names destroys my plans of incremental
generation of wrappers without generating an additional file with
necessary information.  Why?  Well, because when you generate wrappers
with a single pyste file it has no way of knowing the exported names
from other pyste files and therefore will not set the bases correctly.

So the only way of doing this would be to allow Pyste to generate the
xml file into an _interface.xml in individual steps and then get Pyste
to use the generated XML files touching only the wrapper files that
changed.  My guess is that this will reduce the time taken to generate
the interface files.  This is what Nicodemus was saying earlier but I
learnt it from 'The University of Hard Knocks'.

Essentially the --only-wrap and --only-main options are useless.
Instead we need a --generate-xml and --use-xml option.  --generate-xml
simply generates the xml file(s) and --use-xml does not call gccxml
and uses the generated xml file(s).  Its up to the build system to
determine when and how to generate the xml file when the interface
file changes and that is quite easy to do.

I've attached a tarball of the files that demonstrate the above
problem with inheritance across several headers.

Anyway, I'd like to know if the above approach for multiple files is
possible or I'm missing something again.  If it is, I can probably
work on a patch sometime, unless Nicodemus has it covered.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: pyste_bug.tar.gz
Type: application/octet-stream
Size: 801 bytes
Desc: pyste bug demo
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030708/789a9046/attachment.obj>

More information about the Cplusplus-sig mailing list