[C++-sig] Pyste and STL types

Patrick Hartling patrick at vrac.iastate.edu
Tue Mar 18 15:23:20 CET 2003


Nicodemus wrote:
> Patrick Hartling wrote:
> 
>> I am having some trouble in my initial experimentation with Pyste.  It 
>> does not seem to like STL types very much.  For example, I have 
>> attached a class declaration and .pyste file that generate the 
>> following stack trace:
>>
>> > python /home/patrick/boost/libs/python/pyste/src/pyste.py 
>> --module=test test.pyste
>> <snip>
>> The same trace results if my class body is empty and I simply include 
>> <string>.  I did try including <vector> instead just to verify that 
>> there wasn't a problem with the <string> header specifically.  I also 
>> tried the header_test.{pyste,h} files in the Pyste examples directory, 
>> and with those, I get this stack trace:
>>
>> > python ../src/pyste.py --module=header_test header_test.pyste
>> <snip>
>>
>> Am I doing something wrong in my use of Pyste?  I am using Python 
>> 2.2.1, GCCXML 0.4.2 with GCC 3.2, elementtree 1.0 (20020728), and the 
>> latest Boost code from the RC_1_30_0 branch.
> 
> 
> 
> Hi Patrick,
> 
> No, you're use is correct. ;)
> I couldn't reproduce those errors on Windows, but in Linux they occur. 
> Shame on me that didn't test all the examples in Linux! I made some 
> fixes and now all the examples work in Linux, including your test file. 
> Please update your copy.

Thanks very much, Nicodemus, things are much improved now.

Based on further usage, I have a question: are unions supported?  I am 
not a Python guru, but I don't think that there is a union concept in 
Python.  In that case, it would make sense if Pyste ran into a problem 
with a class containing a public data member that is a union type.  I 
would grant that the C++ class I have in mind should probably 
encapsulate its data better, but in the meantime, should exclude() work 
to keep the union data member out of the mix?  With the attached .h and 
.pyste files, I get this stack trace:

Traceback (most recent call last):
   File "/home/patrick/boost/libs/python/pyste/src/pyste.py", line 153, in ?
     status = Main()
   File "/home/patrick/boost/libs/python/pyste/src/pyste.py", line 116, 
in Main
     export.Parse(parser)
   File "/home/patrick/boost/libs/python/pyste/src/Exporter.py", line 
22, in Parse
     self.SetDeclarations(declarations)
   File "/home/patrick/boost/libs/python/pyste/src/ClassExporter.py", 
line 62, in SetDeclarations
     [x for x in self.class_.members if x.visibility == Scope.public]
AttributeError: 'Declaration' object has no attribute 'visibility'

My environment is the same as described above.

  -Patrick


-- 
Patrick L. Hartling                     | Research Assistant, VRAC
patrick at vrac.iastate.edu                | 2624 Howe Hall: 1.515.294.4916
http://www.137.org/patrick/             | http://www.vrac.iastate.edu/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: union.h
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030318/ec311678/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: union.pyste
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20030318/ec311678/attachment-0001.txt>


More information about the Cplusplus-sig mailing list