Message109281
When you open a socket._fileobject through sock.makefile('rb') or similar and you read blocking in one thread and close the file object from another thread the reading thread gets an AttributeError. This is because the close method sets the underlying fileobject._sock member to None and the read/readline/... methods call recv on this member without checking if its None. I think the _sock member should not be set to None at all but a flag should be set that this file object is closed.
For the time being I use the "bugfix" I attached and therefore do not call sock.makefile('rb') but FileObject(sock, 'rb'). FileObject is a subtype of socket._fileobject that overrides the close method and closed property.
I don't know if this bug persists in 2.7 or 3.x. I still use Fedora 12 and that comes with Python 2.6.2. |
|
Date |
User |
Action |
Args |
2010-07-05 01:21:35 | panzi | set | recipients:
+ panzi |
2010-07-05 01:21:35 | panzi | set | messageid: <1278292895.39.0.187416203103.issue9156@psf.upfronthosting.co.za> |
2010-07-05 01:21:33 | panzi | link | issue9156 messages |
2010-07-05 01:21:32 | panzi | create | |
|