Commit 054ad56e authored by Fantix King's avatar Fantix King Committed by Denis Bilenko

Fix str/bytes issue.

 * udp_client.py
 * gevent/subprocess.py
parent cc1f2425
......@@ -16,6 +16,6 @@ message = ' '.join(sys.argv[1:])
sock = socket.socket(type=socket.SOCK_DGRAM)
sock.connect(address)
print('Sending %s bytes to %s:%s' % ((len(message), ) + address))
sock.send(message)
sock.send(message.encode())
data, address = sock.recvfrom(8192)
print('%s:%s: got %r' % (address + (data, )))
......@@ -143,13 +143,13 @@ def check_output(*popenargs, **kwargs):
The arguments are the same as for the Popen constructor. Example:
>>> check_output(["ls", "-1", "/dev/null"])
'/dev/null\n'
b'/dev/null\n'
The stdout argument is not allowed as it is used internally.
To capture standard error in the result, use stderr=STDOUT.
>>> check_output(["/bin/sh", "-c", "echo hello world"], stderr=STDOUT)
'hello world\n'
b'hello world\n'
"""
if 'stdout' in kwargs:
raise ValueError('stdout argument not allowed, it will be overridden.')
......
......@@ -12,7 +12,7 @@ class Test_udp_client(TestCase):
def handle(message, address):
log.append(message)
server.sendto('reply-from-server', address)
server.sendto(b'reply-from-server', address)
server = DatagramServer('127.0.0.1:9000', handle)
server.start()
......@@ -20,7 +20,7 @@ class Test_udp_client(TestCase):
run([sys.executable, '-u', 'udp_client.py', 'Test_udp_client'], timeout=10, cwd='../examples/')
finally:
server.close()
self.assertEqual(log, ['Test_udp_client'])
self.assertEqual(log, [b'Test_udp_client'])
if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment