mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-43952: Fix multiprocessing Listener authkey bug (GH-25845)
Listener.accept() no longer hangs when authkey is an empty bytes object.
This commit is contained in:
parent
3a72fc36f9
commit
686ec17f50
3 changed files with 23 additions and 1 deletions
|
@ -3504,6 +3504,25 @@ class _TestListener(BaseTestCase):
|
|||
if self.TYPE == 'processes':
|
||||
self.assertRaises(OSError, l.accept)
|
||||
|
||||
def test_empty_authkey(self):
|
||||
# bpo-43952: allow empty bytes as authkey
|
||||
def handler(*args):
|
||||
raise RuntimeError('Connection took too long...')
|
||||
|
||||
def run(addr, authkey):
|
||||
client = self.connection.Client(addr, authkey=authkey)
|
||||
client.send(1729)
|
||||
|
||||
key = b""
|
||||
|
||||
with self.connection.Listener(authkey=key) as listener:
|
||||
threading.Thread(target=run, args=(listener.address, key)).start()
|
||||
with listener.accept() as d:
|
||||
self.assertEqual(d.recv(), 1729)
|
||||
|
||||
if self.TYPE == 'processes':
|
||||
self.assertRaises(OSError, listener.accept)
|
||||
|
||||
@unittest.skipUnless(util.abstract_sockets_supported,
|
||||
"test needs abstract socket support")
|
||||
def test_abstract_socket(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue