From 9ffb1481d8103407d3d09d212993ab7c36c58087 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Tue, 10 Dec 2013 18:22:03 -0800 Subject: [PATCH] Fixes 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. --- Lib/telnetlib.py | 7 +++++-- Misc/NEWS | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/telnetlib.py b/Lib/telnetlib.py index 727e8f7c68..88aa482d01 100644 --- a/Lib/telnetlib.py +++ b/Lib/telnetlib.py @@ -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: diff --git a/Misc/NEWS b/Misc/NEWS index b7e51a5ae5..cdcdda3f02 100644 --- 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 -- 2.50.1