]> granicus.if.org Git - python/commitdiff
Fixes Issue #17200: telnetlib's read_until and expect timeout was broken by the
authorGregory P. Smith <greg@krypto.org>
Wed, 11 Dec 2013 02:22:03 +0000 (18:22 -0800)
committerGregory P. Smith <greg@krypto.org>
Wed, 11 Dec 2013 02:22:03 +0000 (18:22 -0800)
fix to Issue #14635 in Python 2.7.4 to be interpreted as milliseconds
instead of seconds when the platform supports select.poll (ie: everywhere).
It is now treated as seconds once again.

Lib/telnetlib.py
Misc/NEWS

index 727e8f7c6881ac373a72fc98a0a7d349b5814db8..88aa482d014db49ba7c7ed77f51e309cf5292d2e 100644 (file)
@@ -312,7 +312,9 @@ class Telnet:
             poller.register(self, poll_in_or_priority_flags)
             while i < 0 and not self.eof:
                 try:
-                    ready = poller.poll(call_timeout)
+                    # Poll takes its timeout in milliseconds.
+                    ready = poller.poll(None if timeout is None
+                                        else 1000 * call_timeout)
                 except select.error as e:
                     if e.errno == errno.EINTR:
                         if timeout is not None:
@@ -682,7 +684,8 @@ class Telnet:
             poller.register(self, poll_in_or_priority_flags)
             while not m and not self.eof:
                 try:
-                    ready = poller.poll(call_timeout)
+                    ready = poller.poll(None if timeout is None
+                                        else 1000 * call_timeout)
                 except select.error as e:
                     if e.errno == errno.EINTR:
                         if timeout is not None:
index b7e51a5ae5f05fdf06206d6d7c7d9cd246871ba4..cdcdda3f0296249aa15c40b71c1feead9693eb5c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -17,6 +17,11 @@ Core and Builtins
 Library
 -------
 
+- Issue #17200: telnetlib's read_until and expect timeout was broken by the
+  fix to Issue #14635 in Python 2.7.4 to be interpreted as milliseconds
+  instead of seconds when the platform supports select.poll (ie: everywhere).
+  It is now treated as seconds once again.
+
 - Issue #19099: The struct module now supports Unicode format strings.
 
 - Issue #19878: Fix segfault in bz2 module after calling __init__ twice with