[C++-sig] Pyste 1.31.0 and exceptions

Dan Halbert halbert at bbn.com
Mon Mar 8 18:12:34 CET 2004


Hi, I am trying to use the Pyste from Boost 1.31.0 with code that uses
exceptions. My impression was that this version of Pyste does support
automatic exception handling, but maybe I am wrong.

I was using gccxml-0.4.2, which does not output any info about exceptions.
I switched to gccxml-0.6.0, which does.

I have this test case:
==============================================
foo.pyste:

foo = AllFromHeader("foo.h")
==============================================
foo.h:

void g() throw (int);                       // line #1
class C { public: void f() throw (int); };  // line #2
==============================================

If I comment out line #2, then I get no errors, but the generated C++
code does not mention the exception for g().

If I comment out line #1 and leave #2 (or uncomment both), then Pyste
gets an error, with the Python stack trace shown below.

I am using "int" exceptions for simplicity in this test case, but I
also get a similar failure with class exceptions.

Thanks,
Dan

==============================================
Traceback (most recent call last):
  File "/d4m/tools/i686ling/Python-2.3.3/bin/pyste.py", line 4, in ?
    pyste.main()
  File "/d4m/tools/i686ling/Python-2.3.3/lib/python2.3/site-packages/Pyste/pyste.py", line 405, in main
    status = Begin()
  File "/d4m/tools/i686ling/Python-2.3.3/lib/python2.3/site-packages/Pyste/pyste.py", line 244, in Begin
    return GenerateCode(parser, module, out, interfaces, multiple)
  File "/d4m/tools/i686ling/Python-2.3.3/lib/python2.3/site-packages/Pyste/pyste.py", line 372, in GenerateCode
    export.GenerateCode(codeunit, exported_names)
  File "/d4m/tools/i686ling/Python-2.3.3/lib/python2.3/site-packages/Pyste/Exporter.py", line 50, in GenerateCode
    self.Export(codeunit, exported_names)
  File "/d4m/tools/i686ling/Python-2.3.3/lib/python2.3/site-packages/Pyste/HeaderExporter.py", line 44, in Export
    self.HandleDeclaration(decl, codeunit, exported_names)
  File "/d4m/tools/i686ling/Python-2.3.3/lib/python2.3/site-packages/Pyste/HeaderExporter.py", line 61, in HandleDeclaration
    self.HandleExporter(decl, exporter_class, codeunit, exported_names)
  File "/d4m/tools/i686ling/Python-2.3.3/lib/python2.3/site-packages/Pyste/HeaderExporter.py", line 77, in HandleExporter
    exporter.GenerateCode(codeunit, exported_names)
  File "/d4m/tools/i686ling/Python-2.3.3/lib/python2.3/site-packages/Pyste/Exporter.py", line 50, in GenerateCode
    self.Export(codeunit, exported_names)
  File "/d4m/tools/i686ling/Python-2.3.3/lib/python2.3/site-packages/Pyste/ClassExporter.py", line 92, in Export
    self.InheritMethods(exported_names)
  File "/d4m/tools/i686ling/Python-2.3.3/lib/python2.3/site-packages/Pyste/ClassExporter.py", line 119, in InheritMethods
    pointers = [x.PointerDeclaration(True) for x in self.class_ if isinstance(x, Method)]
  File "/d4m/tools/i686ling/Python-2.3.3/lib/python2.3/site-packages/Pyste/declarations.py", line 320, in PointerDeclaration
    return '(%s (%s::*)(%s) %s%s)&%s' %\
  File "/d4m/tools/i686ling/Python-2.3.3/lib/python2.3/site-packages/Pyste/declarations.py", line 226, in Exceptions
    return " throw(%s)" % ', '.join (self.throws)
TypeError: sequence item 0: expected string, FundamentalType found





More information about the Cplusplus-sig mailing list