Commit a9bae010 authored by Denis Bilenko's avatar Denis Bilenko

fix sleep(negative value) to raise an exception, like stdlib's sleep() does. Issue #20

parent 924e6682
......@@ -66,6 +66,8 @@ def sleep(seconds=0):
expressing a cooperative yield.
"""
unique_mark = object()
if not seconds >= 0:
raise IOError(22, 'Invalid argument')
timer = core.timer(seconds, getcurrent().switch, unique_mark)
try:
switch_result = get_hub().switch()
......
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