diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2008-01-27 18:19:04 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2008-01-27 18:19:04 (GMT) |
commit | ed444e52da16d947212afbbc200647a8c8f5b53f (patch) | |
tree | b6ac32337a5cf9585d33cbeba6df33b8f9090fa6 | |
parent | ce8fd9d2bc337f637cd55eb6701b99e24ad1549b (diff) | |
download | cpython-ed444e52da16d947212afbbc200647a8c8f5b53f.zip cpython-ed444e52da16d947212afbbc200647a8c8f5b53f.tar.gz cpython-ed444e52da16d947212afbbc200647a8c8f5b53f.tar.bz2 |
Try to handle socket.errors properly in is_unavailable
-rw-r--r-- | Lib/test/test_xmlrpc.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py index 17d7a7a..70a6b39 100644 --- a/Lib/test/test_xmlrpc.py +++ b/Lib/test/test_xmlrpc.py @@ -348,10 +348,14 @@ def is_unavailable_exception(e): given by operations on non-blocking sockets.''' # sometimes we get a -1 error code and/or empty headers - if e.errcode == -1 or e.headers is None: - return True + try: + if e.errcode == -1 or e.headers is None: + return True + exc_mess = e.headers.get('X-exception') + except AttributeError: + # Ignore socket.errors here. + exc_mess = str(e) - exc_mess = e.headers.get('X-exception') if exc_mess and 'temporarily unavailable' in exc_mess.lower(): return True |