aboutsummaryrefslogtreecommitdiffstats
path: root/netlib
diff options
context:
space:
mode:
Diffstat (limited to 'netlib')
-rw-r--r--netlib/tcp.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/netlib/tcp.py b/netlib/tcp.py
index de12102e..0eec326b 100644
--- a/netlib/tcp.py
+++ b/netlib/tcp.py
@@ -580,8 +580,10 @@ class _Connection(object):
@contextlib.contextmanager
def _closer(client):
- yield
- client.close()
+ try:
+ yield
+ finally:
+ client.close()
class TCPClient(_Connection):