[PyQt] Regrettable behaviour of threading.local in QThread
asuffield at suffields.me.uk
Sat Apr 7 06:42:27 BST 2012
The attached script creates a threading.local within a QThread, and
stores a value in it. It then reads this value back immediately, and
later from an event handler.
Unexpectedly, by the time we get to the event handler, the contents of
the threading.local has been destroyed.
I suspect there are infelicitious interactions between QThread,
thread._local, and the garbage collector. I haven't looked closely;
it's easier to work around the problem. It's possible this is a python
bug in the handling of alien threads.
Tripped over this one because it breaks sqlalchemy's scoped_session
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 848 bytes
Desc: not available
More information about the PyQt