Sat, 04 May 2002 16:15:01 -0400
That's awesome that you put the timeout functionality into the C-level
socket module. I'd vote that it is "The Right"(tm) way to include this
feature in the standard library. You guys rock!
I couldn't get to the web site you indicated, so pardon this question
if I could have found the answer on-line somewhere.
How did you handle the _fileobject class in the standard socket.py?
The version in Python-2.2 will lose data if the underlying socket raises
an exception during a read() or readlines(). Basically, these two
routines use a local variable to store the incoming data -- and that
local variable will go out of scope after the exception during recv().
I believe that the TimeoutFile class in the socket.py version I thew
together fixes this issue. Of course, you may have already noticed
and fixed this, too.
Again, very awesome!
"Everything I did in life that was worthwhile I caught hell for."
- former U.S. Supreme Court Chief Justice Earl Warren
> From: Bernard Yue <email@example.com>
> Date: Fri, 03 May 2002 01:49:02 -0600
> To: "Timothy O'Malley" <firstname.lastname@example.org>
> Cc: email@example.com, firstname.lastname@example.org, email@example.com
> Subject: Re: [Python-Dev] timeoutsocket.py
> Timothy O'Malley wrote:
>> I've taken a whack at option #1 (grand unification of socket and
>> It's larger than I'd prefer to send in email. If you are interested:
> Tim, this is a complete rewrite of timeoutsocket.py. It is quite an
> effort :)
>> 1. Shall we merge socket.py and timeoutsocket.py?
>> It certainly is possible to merge TimeoutSocket and _socketobject.
>> If the merge was done in a straightforward manner, then every TCP
>> socket would use Python code (instead of C code) for recv() and
>> send() methods. Some might consider this an unacceptable performance
> I agree on the performance issue. Over the past two weeks, Michael
> Gilfix and I moved ahead with the implementing of timeout socket in C
> level. Michael translates what you've done in timeoutsocket.py and put
> it into socket.c. So far we did nothing to TimeoutFile. The proposed
> patch is basically done (except for the test case). You can find it on
> We are now working on the test case for connect() and sendfoo().
> Currently, test for connect() is done by trying a timeout connect to an
> external site (same to what you've done). However, we wanted to remove
> the external dependency on standard python test suit. So far no luck of
> make it working, and I cannot make sendfoo() to raise timeout error at
> Would you like to help us with the test?
> There are three schools of magic. One: State a tautology, then ring
> the changes on its corollaries; that's philosophy. Two: Record many
> facts. Try to find a pattern. Then make a wrong guess at the next
> fact; that's science. Three: Be aware that you live in a malevolent
> Universe controlled by Murphy's Law, sometimes offset by Brewster's
> Factor; that's engineering.
> -- Robert A. Heinlein