mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
SF patch 1631942 by Collin Winter:
(a) "except E, V" -> "except E as V" (b) V is now limited to a simple name (local variable) (c) V is now deleted at the end of the except block
This commit is contained in:
parent
893523e80a
commit
b940e113bf
295 changed files with 817 additions and 743 deletions
|
@ -119,7 +119,7 @@ def poll(timeout=0.0, map=None):
|
|||
else:
|
||||
try:
|
||||
r, w, e = select.select(r, w, e, timeout)
|
||||
except select.error, err:
|
||||
except select.error as err:
|
||||
if err[0] != EINTR:
|
||||
raise
|
||||
else:
|
||||
|
@ -165,7 +165,7 @@ def poll2(timeout=0.0, map=None):
|
|||
pollster.register(fd, flags)
|
||||
try:
|
||||
r = pollster.poll(timeout)
|
||||
except select.error, err:
|
||||
except select.error as err:
|
||||
if err[0] != EINTR:
|
||||
raise
|
||||
r = []
|
||||
|
@ -320,7 +320,7 @@ class dispatcher:
|
|||
try:
|
||||
conn, addr = self.socket.accept()
|
||||
return conn, addr
|
||||
except socket.error, why:
|
||||
except socket.error as why:
|
||||
if why[0] == EWOULDBLOCK:
|
||||
pass
|
||||
else:
|
||||
|
@ -330,7 +330,7 @@ class dispatcher:
|
|||
try:
|
||||
result = self.socket.send(data)
|
||||
return result
|
||||
except socket.error, why:
|
||||
except socket.error as why:
|
||||
if why[0] == EWOULDBLOCK:
|
||||
return 0
|
||||
else:
|
||||
|
@ -347,7 +347,7 @@ class dispatcher:
|
|||
return ''
|
||||
else:
|
||||
return data
|
||||
except socket.error, why:
|
||||
except socket.error as why:
|
||||
# winsock sometimes throws ENOTCONN
|
||||
if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN]:
|
||||
self.handle_close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue