[Python-Dev] timeoutsocket.py

Bernard Yue bernie@3captus.com
Mon, 06 May 2002 14:26:03 -0600


Timothy O'Malley wrote:
> 
> hola.
> 
> 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!
>

[snip] 

> I couldn't get to the web site you indicated, so pardon this question
> if I could have found the answer on-line somewhere.
> 

The site was down <sign>.  IS is now back up.

> How did you handle the _fileobject class in the standard socket.py?

We didn't.

> 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'll modify the test case to see what happens.

> 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.
> 

So it is why TimeoutFile was there in the first place.


Bernie
-- 
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