[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Adonthell-devel] Python weirdness (a real weirdy one) - please test
From: |
Alexandre Courbot |
Subject: |
Re: [Adonthell-devel] Python weirdness (a real weirdy one) - please test |
Date: |
Mon, 28 Jul 2003 17:08:05 +0200 |
User-agent: |
KMail/1.5 |
> For some reason, I think that there are some bugs in the python
> callback stuff. Because with your gfxtest code, I get exactly the same
> error that I get with inputtest.py. (Although that could also be
> something OS X related). Anyway, I am using 2.2.2 as well. On running
> gfxtest.py, I get a black window with a little white rectangle. After
> pressing a key, I get:
Don't know if it's the same problem as yours, but I just solved my error. And
of course it was my fault. :p Looking forward to know whether it makes you
have better karma with MacOS X.
There was actually two errors of mine. The first one is that the callback in
gfxtest didn't return an integer (now a boolean) to inform the manager
whether it caught the event or not. Making the callback return an integer
solves the problem. And the problem was - precisely - a TypeError involving
an integer. So obviously it was that error that delayed.
The other error was that I didn't caught this error. In
python::retrieve_instance<int> I make no check about whether things went
right or not. It is fixed, and now such errors are displayed in the console
in time, and doesn't bother SWIG wrappers anymore. Good!
So I've put lots of show_traceback after my Python operations. I don't think
they will cost much. show_traceback is not more than a call to
PyErr_Occured() when things went right, and I doubt it does much more than
just returning a Python variable.
My investigation did more than just fixing this, since I discovered another
bug in the callback code: the reference to the function was INCREF'ed one
time too much, causing a slight memory leak.
Alex.
--
http://www.gnurou.org