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 skip.montanaro
Recipients
Date 2003-08-04.13:53:11
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=44345

The original socket.makefile dup()s the socket to create a new
file descriptor.  If you have a timeout set on the original socket
the new file descriptor loses this property.  This was a big
problem for the various modules which sit atop socket (httplib,
etc) because they generally all just call s.makefile() and then
treat the connected socket as a file.  These are precisely the
modules/classes which benefit most from socket timeouts.

Note also that the current Unix implementation is what Windows
(and any other platforms without a dup() system call) use to
emulate makefile().

In the long run, I see a few other possibilities.  Note that I
haven't considered the first two in any detail.  I'm in the midst
of working on the third.

1. Add timeout functionality to the various higher-level modules
such as httplib.  Once they call s.makefile() they could propagate
their current timeout to the new file object.  Of course, this
means file objects need to be able to timeout (not obvious that
this is generally possible).

2. Store timeout information in the socket, so that if it's dup()'d
it propagates the timeout to the new descriptor.  Again, it's not
obvious that this is possible.

3. Extend more general object support to marshal.  I am working
on this and hope to have something available for review later
this week.  As Martin indicated, it's not unreasonable to expect
people wanting to marshal data to non-file objects to first pass
them through marshal.dumps().  You can't, for example,
marshal data to StringIO objects directly.
  
History
Date User Action Args
2007-08-23 14:15:31adminlinkissue780354 messages
2007-08-23 14:15:31admincreate