Joel Lovinger <jlovin...@gmail.com> added the comment:

2.4 behavior, "time out if there is no more data for X seconds", only worked as 
expected in the case of timeout=0. Any other timeout could result in indefinite 
extension and needed fixing.

2.7 behavior, "time out if there is no match for X seconds" fixes timeout!=0 
cases while breaking for timeout=0.

Can't get former behavior on timeout=0 in 2.7 using socket.settimeout(). Call 
to socket.recv() then throws a timeout exception which isn't caught by 
Telnet.expect.

I think fixing timeout=0 will require a patch to Telnet.expect. The simplest 
would likely be to insert a "very eager" type read to grab all data without 
blocking before entering the match loop. Won't need to modify existing timeout 
logic and sidesteps any new corner cases on select/recv iteration.

The only functional side effect (other than moving storage in some cases from 
the socket to the Telnet object) is on greedy RE that will have more data to 
match. Documentation already warns against greedy RE as non-deterministic so 
hopefully not an issue.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14556>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to