New submission from Joel Lovinger <jlovin...@gmail.com>: In Python 2.4.3 a Telnet.expect with timeout=0 would always make at least one call to Telnet.fill_rawq if a match couldn't be found and the connection was open.
In Python 2.7.1/2.7.3 Telnet.expect with timeout=0 breaks before any call to Telnet.fill_rawq if a match isn't found in already read raw/cooked data. Expected behavior is that on timeout=0 at least one non-blocking attempt should be made to read from the connection when necessary to fulfill a match. >From code inspection (including Python 2.7.3) timeout behavior was modified to >provide an overall elapsed timeout instead of passing unmodified timeout to >each select resulting in the failure. Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from telnetlib import Telnet >>> import time >>> tn = Telnet("scn.org", 23) >>> time.sleep(5) # short wait for data to be available >>> tn.expect(['.{16}'], 0) (-1, None, '') >>> Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from telnetlib import Telnet >>> import time >>> tn = Telnet("scn.org", 23) >>> time.sleep(5) # short wait for data to be available >>> tn.expect(['.{16}'], 0) (0, <_sre.SRE_Match object at 0x01752410>, '\r\nSeattle Communit') >>> ---------- components: Library (Lib) messages: 158096 nosy: Joel.Lovinger priority: normal severity: normal status: open title: telnetlib Telnet.expect fails with timeout=0 type: behavior versions: Python 2.7 _______________________________________ 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