PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy.

This commit is contained in:
Antoine Pitrou 2011-10-12 02:54:14 +02:00
parent 983b1434bd
commit 6b4883dec0
21 changed files with 689 additions and 454 deletions

View file

@ -321,7 +321,7 @@ if win32:
firstchunk = overlapped.getbuffer()
assert lenfirstchunk == len(firstchunk)
except IOError as e:
if e.errno == win32.ERROR_BROKEN_PIPE:
if e.winerror == win32.ERROR_BROKEN_PIPE:
raise EOFError
raise
buf.write(firstchunk)
@ -669,7 +669,7 @@ if sys.platform == 'win32':
try:
win32.ConnectNamedPipe(handle, win32.NULL)
except WindowsError as e:
if e.args[0] != win32.ERROR_PIPE_CONNECTED:
if e.winerror != win32.ERROR_PIPE_CONNECTED:
raise
return PipeConnection(handle)
@ -692,8 +692,8 @@ if sys.platform == 'win32':
0, win32.NULL, win32.OPEN_EXISTING, 0, win32.NULL
)
except WindowsError as e:
if e.args[0] not in (win32.ERROR_SEM_TIMEOUT,
win32.ERROR_PIPE_BUSY) or _check_timeout(t):
if e.winerror not in (win32.ERROR_SEM_TIMEOUT,
win32.ERROR_PIPE_BUSY) or _check_timeout(t):
raise
else:
break