[PyQt] SystemError with a temporary variable when accessing a non-existing attribute

Phil Thompson phil at riverbankcomputing.com
Tue Jul 22 19:30:10 BST 2008


On Fri, 11 Jul 2008 20:45:24 -0700, "Erick Tryzelaar"
<idadesub at users.sourceforge.net> wrote:
> Good evening, I'm getting an interesting error with sip and pointers.
> Here's my trimmed down code:
> 
> --------------------------------------------------------
> #ifndef FOO_H
> #define FOO_H
> 
> #include <QDebug>
> 
> class Foo
> {
> public:
>     Foo() {}
>     virtual ~Foo() { qDebug() << "Foo::~Foo"; }
> };
> 
> class Bar: public Foo
> {
> public:
>     Bar(Foo* foo):foo(foo) {}
>     virtual ~Bar() { qDebug() << "Bar::~Bar"; delete foo; }
> 
> private:
>     Foo* foo;
> };
> 
> #endif
> --------------------------------------------------------
> 
> And my sip code:
> 
> --------------------------------------------------------
> %Module _jazz 0
> 
> class Foo
> {
> %TypeHeaderCode
> #include "../foo.h"
> %End
> 
> public:
>   Foo();
>   virtual ~Foo();
> };
> 
> class Bar: Foo
> {
> %TypeHeaderCode
> #include "../foo.h"
> %End
> 
> public:
>   Bar(Foo* foo /Transfer/);
>   virtual ~Bar();
> };
> --------------------------------------------------------
> 
> 
> And when used like this, I get this error:
> 
>>>> import _jazz
>>>> print _jazz.Bar(_jazz.Foo()).foo
> Bar::~Bar
> Foo::~Foo
> Foo::~Foo
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> SystemError: error return without exception set
> 
> 
> What am I doing wrong? Thanks for the help.

Fixed in tonight's SIP snapshot.

Phil



More information about the PyQt mailing list