Commit f1db162c authored by Jason Madden's avatar Jason Madden

Let the Timeout class update the loop time when used internally. Otherwise,...

Let the Timeout class update the loop time when used internally. Otherwise, test_telnetlib.py 'hangs'. Not exactly clear why, but at a guess apparently we're not getting out of the timer callback loop.
parent a01382a6
......@@ -152,7 +152,7 @@ class Timeout(BaseException):
self.timer.start(getcurrent().throw, self.exception)
@classmethod
def start_new(cls, timeout=None, exception=None, ref=True):
def start_new(cls, timeout=None, exception=None, ref=True, _update=None):
"""Create a started :class:`Timeout`.
This is a shortcut, the exact action depends on *timeout*'s type:
......@@ -169,6 +169,8 @@ class Timeout(BaseException):
timeout.start()
return timeout
timeout = cls(timeout, exception, ref=ref)
if _update:
get_hub().loop.update()
timeout.start()
return timeout
......@@ -187,7 +189,9 @@ class Timeout(BaseException):
# under PyPy in synthetic benchmarks it makes no difference.
if timeout is None:
return _FakeTimer
return Timeout.start_new(timeout, exception)
# If we don't update the time here (and the timer watcher doesn't),
# as under libuv, then certain tests hang, notably the monkey-patched test_telnetlib
return Timeout.start_new(timeout, exception, _update=True)
@property
def pending(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment