[tor-commits] [stem/master] Don't suppress socket closing exceptions
atagar at torproject.org
atagar at torproject.org
Sun Jan 5 21:39:28 UTC 2020
commit e91d0ef934a700699403fd3172ee98f0a7915193
Author: Damian Johnson <atagar at torproject.org>
Date: Sun Jan 5 12:15:17 2020 -0800
Don't suppress socket closing exceptions
We'll revert this if it becomes an issue in practice, but the comment says that
we suppress exceptions due to python 2.x. I tried closing a socket multiple
times with python 3.x and it did not raise an exception, so for the moment we
don't have a known reason to expect these calls to error.
---
stem/socket.py | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/stem/socket.py b/stem/socket.py
index 275a55d4..4105152f 100644
--- a/stem/socket.py
+++ b/stem/socket.py
@@ -204,21 +204,10 @@ class BaseSocket(object):
except socket.error:
pass
- # Suppressing unexpected exceptions from close. For instance, if the
- # socket's file has already been closed then with python 2.7 that raises
- # with...
- # error: [Errno 32] Broken pipe
-
- try:
- self._socket.close()
- except:
- pass
+ self._socket.close()
if self._socket_file:
- try:
- self._socket_file.close()
- except:
- pass
+ self._socket_file.close()
self._socket = None
self._socket_file = None
More information about the tor-commits
mailing list