[C++-sig] Pyste and STL types
Nicodemus
nicodemus at globalite.com.br
Tue Mar 18 16:03:15 CET 2003
----- Original Message -----
From: "Patrick Hartling" <patrick at vrac.iastate.edu>
To: <c++-sig at python.org>
Sent: Tuesday, March 18, 2003 11:23 AM
Subject: Re: [C++-sig] Pyste and STL types
> 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:
> <snip trace>
> AttributeError: 'Declaration' object has no attribute 'visibility'
>
> My environment is the same as described above.
>
> -Patrick
Hi Patrick,
It seems that Boost.Python doesn't support unions. The following code fails
to compile:
union test
{
int t1;
short s1;
short s2;
};
// Module
======================================================================
BOOST_PYTHON_MODULE(_3d)
{
class_<test>("test")
.def_readwrite("t1", &test::t1)
.def_readwrite("s1", &test::s1)
.def_readwrite("s2", &test::s2)
;
}
More information about the Cplusplus-sig
mailing list