[tor-commits] [chutney/master] Python3: get socket errno from errno attr, not from subscripting

nickm at torproject.org nickm at torproject.org
Mon Mar 11 00:33:44 UTC 2019


commit e54f24dfb49101bd73fb617e94ea6afd51ba1e90
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Feb 28 12:36:23 2019 -0500

    Python3: get socket errno from errno attr, not from subscripting
---
 lib/chutney/Traffic.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/chutney/Traffic.py b/lib/chutney/Traffic.py
index 283f286..0c7776a 100644
--- a/lib/chutney/Traffic.py
+++ b/lib/chutney/Traffic.py
@@ -213,7 +213,7 @@ class Source(Peer):
             debug("socket %d connecting to %r..."%(self.fd(),dest))
             self.s.connect(dest)
         except socket.error as e:
-            if e[0] != errno.EINPROGRESS:
+            if e.errno != errno.EINPROGRESS:
                 raise
 
     def on_readable(self):
@@ -288,7 +288,7 @@ class Source(Peer):
         try:
             n = self.s.send(self.outbuf)
         except socket.error as e:
-            if e[0] == errno.ECONNREFUSED:
+            if e.errno == errno.ECONNREFUSED:
                 debug("connection refused (fd=%d)" % self.fd())
                 return -1
             raise





More information about the tor-commits mailing list