Phil Thompson phil at river-bank.demon.co.uk
Fri Jul 12 11:11:00 BST 2002

On Friday 12 July 2002 4:13 am, Donovan Rebbechi wrote:
> I've noticed that sip generated code wraps C++ calls in a block like this:
> From my own experimentation (or blundering), I  gather that I need to
> place C++ calls in such a block, and need to make sure I don't return
> or set the error handle from inside it. Is this correct ? I'm confused
> about why calling a C++ function would require unblocking (I get
> PyThreadState_Get: no current thread if I don't use these blocks)

It requiries unblocking to guarantee that the state is unblocked when the 
generated code next tries to make a call to the Python API. You might think 
that you know when the next call would be (ie. after the call to your C++ 
function returns) so why bother with the overhead - but you have no idea what 
the C++ function might do. It might switch thread contexts, or it might call 
a C++ virtual method that has been re-implemented in Python.


More information about the PyQt mailing list