From: Ben Darnell Date: Tue, 25 May 2010 18:40:42 +0000 (-0700) Subject: Don't try to compute max() of an empty sequence (which throws an exception) X-Git-Tag: v1.0.0~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57a9ac031a86aa1389144ea06638b5550d525b3e;p=thirdparty%2Ftornado.git Don't try to compute max() of an empty sequence (which throws an exception) --- diff --git a/tornado/httpclient.py b/tornado/httpclient.py index 899f1636c..75adb63a7 100644 --- a/tornado/httpclient.py +++ b/tornado/httpclient.py @@ -226,7 +226,7 @@ class AsyncHTTPClient(object): for fd in exceptable: fds[fd] = fds.get(fd, 0) | 0x8 | 0x10 - if max(fds.iterkeys()) > 900: + if fds and max(fds.iterkeys()) > 900: # Libcurl has a bug in which it behaves unpredictably with # file descriptors greater than 1024. (This is because # even though it uses poll() instead of select(), it still