Open ColCarroll opened 6 years ago
Hi! This is a useful project, but appears to fail on generators. Namely, this function:
import time from timeout_decorator import timeout @timeout(seconds=0.5) def sleeper(s): for j in range(10): time.sleep(s) yield j
runs fine regardless of the value of s: try list(sleeper(0.1)), or list(sleeper(1)), for example.
s
list(sleeper(0.1))
list(sleeper(1))
Also, setting use_signals=False, makes everything fail after seconds:
use_signals=False
seconds
@timeout(seconds=0.5, use_signals=False) def sleeper(s): for j in range(10): time.sleep(s) yield j
For example, list(sleeper(0.01)), or even just sleeper(0) both throw an error after 0.5s. Indeed,
list(sleeper(0.01))
sleeper(0)
for j in sleeper(0.1): print(j)
does not print anything before failing after 0.5s.
Same here. The decorator works fine under "normal" conditions, but fail with decorators.
Hi! This is a useful project, but appears to fail on generators. Namely, this function:
runs fine regardless of the value of
s
: trylist(sleeper(0.1))
, orlist(sleeper(1))
, for example.Also, setting
use_signals=False
, makes everything fail afterseconds
:For example,
list(sleeper(0.01))
, or even justsleeper(0)
both throw an error after 0.5s. Indeed,does not print anything before failing after 0.5s.