Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7357c23

Browse files
committed
Fix exception slicing.
1 parent 74f3669 commit 7357c23

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Lib/asyncore.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def accept(self):
321321
conn, addr = self.socket.accept()
322322
return conn, addr
323323
except socket.error as why:
324-
if why[0] == EWOULDBLOCK:
324+
if why.args[0] == EWOULDBLOCK:
325325
pass
326326
else:
327327
raise
@@ -331,7 +331,7 @@ def send(self, data):
331331
result = self.socket.send(data)
332332
return result
333333
except socket.error as why:
334-
if why[0] == EWOULDBLOCK:
334+
if why.args[0] == EWOULDBLOCK:
335335
return 0
336336
else:
337337
raise
@@ -349,7 +349,7 @@ def recv(self, buffer_size):
349349
return data
350350
except socket.error as why:
351351
# winsock sometimes throws ENOTCONN
352-
if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN]:
352+
if why.args[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN]:
353353
self.handle_close()
354354
return b''
355355
else:

0 commit comments

Comments
 (0)