[PyQt] Possible bug in QReadLocker and Python 2.7

Phil Thompson phil at riverbankcomputing.com
Tue Oct 12 22:45:30 BST 2010


On Tue, 12 Oct 2010 15:50:21 +0100, Daniele Esposti <expo at expobrain.net>
wrote:
> Running the attached test under Python 2.7 raises an attribute error:
> 
> Traceback (most recent call last):
>   File "locker.py", line 11, in <module>
> 	with QtCore.QReadLocker( lock ):
> AttributeError: __exit__
> 
> Tested with Python 2.7, PyQt4 4.7.7-1, sip 4.11.1 under Windows and
Linux.
> The same code works well using Python 2.6.6, PyQt4 4.7.7-1, sip 4.11.1
> under Windows and Linux.
> Under Windows I'm using the binary package; under Linux I'm using the
> source code.
> 
> Is this a bug in QReadLocker() bindings ?

It's caused by a change in the way context managers are implemented in
Python v2.7 (and v3.2).

Fixed in tonight's SIP snapshot.

Thanks,
Phil


More information about the PyQt mailing list