Additional error checking, as required by test_select's exacting standards.

This commit is contained in:
Ryan Williams
2010-01-15 22:38:12 -08:00
parent 662d7b998d
commit bf36075800

View File

@@ -1,3 +1,5 @@
__select = __import__('select') __select = __import__('select')
error = __select.error error = __select.error
from eventlet.api import getcurrent from eventlet.api import getcurrent
@@ -21,6 +23,12 @@ def get_fileno(obj):
return rv return rv
def select(read_list, write_list, error_list, timeout=None): def select(read_list, write_list, error_list, timeout=None):
# error checking like this is required by the stdlib unit tests
if timeout is not None:
try:
timeout = float(timeout)
except ValueError:
raise TypeError("Expected number for timeout")
hub = get_hub() hub = get_hub()
t = None t = None
current = getcurrent() current = getcurrent()