QPID-8631: remember exception to raise, due to changed py3 exception object lifetime
diff --git a/qpid/util.py b/qpid/util.py
index b91005a..fd5c26d 100644
--- a/qpid/util.py
+++ b/qpid/util.py
@@ -79,9 +79,10 @@
break
except socket.error as msg:
sock.close()
+ last_msg = msg # https://portingguide.readthedocs.io/en/latest/exceptions.html#caught-exception-scope
else:
# If we got here then we couldn't connect (yet)
- raise
+ raise last_msg
return sock
def listen(host, port, predicate = lambda: True, bound = lambda: None):