mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Fix test_asyncore after merge. It needs to use bytes.
This commit is contained in:
parent
b5a755e46c
commit
df4a743ac0
2 changed files with 16 additions and 14 deletions
|
|
@ -344,14 +344,14 @@ class dispatcher:
|
|||
# a closed connection is indicated by signaling
|
||||
# a read condition, and having recv() return 0.
|
||||
self.handle_close()
|
||||
return ''
|
||||
return b''
|
||||
else:
|
||||
return data
|
||||
except socket.error as why:
|
||||
# winsock sometimes throws ENOTCONN
|
||||
if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN]:
|
||||
self.handle_close()
|
||||
return ''
|
||||
return b''
|
||||
else:
|
||||
raise
|
||||
|
||||
|
|
@ -447,7 +447,7 @@ class dispatcher_with_send(dispatcher):
|
|||
|
||||
def __init__(self, sock=None, map=None):
|
||||
dispatcher.__init__(self, sock, map)
|
||||
self.out_buffer = ''
|
||||
self.out_buffer = b''
|
||||
|
||||
def initiate_send(self):
|
||||
num_sent = 0
|
||||
|
|
@ -461,6 +461,7 @@ class dispatcher_with_send(dispatcher):
|
|||
return (not self.connected) or len(self.out_buffer)
|
||||
|
||||
def send(self, data):
|
||||
assert isinstance(data, bytes)
|
||||
if self.debug:
|
||||
self.log_info('sending %s' % repr(data))
|
||||
self.out_buffer = self.out_buffer + data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue