[Part of patch #909005] Repeating exception changed from 'raise socket.error, why' to just raise. Make use of connect_ex() raise socket.error with 2-tuple instead of just error code

This commit is contained in:
Andrew M. Kuchling 2004-03-21 19:58:28 +00:00
parent 419af88b34
commit 174bdbc999
1 changed files with 5 additions and 5 deletions

View File

@ -54,7 +54,7 @@ import time
import os import os
from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \ from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \
ENOTCONN, ESHUTDOWN, EINTR, EISCONN ENOTCONN, ESHUTDOWN, EINTR, EISCONN, errorcode
try: try:
socket_map socket_map
@ -287,7 +287,7 @@ class dispatcher:
self.connected = True self.connected = True
self.handle_connect() self.handle_connect()
else: else:
raise socket.error, err raise socket.error, (err, errorcode[err])
def accept(self): def accept(self):
# XXX can return either an address pair or None # XXX can return either an address pair or None
@ -298,7 +298,7 @@ class dispatcher:
if why[0] == EWOULDBLOCK: if why[0] == EWOULDBLOCK:
pass pass
else: else:
raise socket.error, why raise
def send(self, data): def send(self, data):
try: try:
@ -308,7 +308,7 @@ class dispatcher:
if why[0] == EWOULDBLOCK: if why[0] == EWOULDBLOCK:
return 0 return 0
else: else:
raise socket.error, why raise
return 0 return 0
def recv(self, buffer_size): def recv(self, buffer_size):
@ -327,7 +327,7 @@ class dispatcher:
self.handle_close() self.handle_close()
return '' return ''
else: else:
raise socket.error, why raise
def close(self): def close(self):
self.del_channel() self.del_channel()