This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author panzi
Recipients panzi
Date 2010-07-05.01:21:31
SpamBayes Score 0.004160458
Marked as misclassified No
Message-id <1278292895.39.0.187416203103.issue9156@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-07-05 01:21:35panzisetrecipients: + panzi
2010-07-05 01:21:35panzisetmessageid: <1278292895.39.0.187416203103.issue9156@psf.upfronthosting.co.za>
2010-07-05 01:21:33panzilinkissue9156 messages
2010-07-05 01:21:32panzicreate