Skip to content

Commit 63fa8db

Browse files
bpo-33532: Fix test_multiprocessing_forkserver.test_ignore() (GH-7319)
Use also support.SOCK_MAX_SIZE, not only support.PIPE_MAX_SIZE, to get the size for a blocking send into a multiprocessing pipe. (cherry picked from commit 252f6ab) Co-authored-by: Victor Stinner <vstinner@redhat.com>
1 parent 29ae9dc commit 63fa8db

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/_test_multiprocessing.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4295,6 +4295,9 @@ def test_closefd(self):
42954295

42964296
class TestIgnoreEINTR(unittest.TestCase):
42974297

4298+
# Sending CONN_MAX_SIZE bytes into a multiprocessing pipe must block
4299+
CONN_MAX_SIZE = max(support.PIPE_MAX_SIZE, support.SOCK_MAX_SIZE)
4300+
42984301
@classmethod
42994302
def _test_ignore(cls, conn):
43004303
def handler(signum, frame):
@@ -4303,7 +4306,7 @@ def handler(signum, frame):
43034306
conn.send('ready')
43044307
x = conn.recv()
43054308
conn.send(x)
4306-
conn.send_bytes(b'x' * support.PIPE_MAX_SIZE)
4309+
conn.send_bytes(b'x' * cls.CONN_MAX_SIZE)
43074310

43084311
@unittest.skipUnless(hasattr(signal, 'SIGUSR1'), 'requires SIGUSR1')
43094312
def test_ignore(self):
@@ -4322,7 +4325,7 @@ def test_ignore(self):
43224325
self.assertEqual(conn.recv(), 1234)
43234326
time.sleep(0.1)
43244327
os.kill(p.pid, signal.SIGUSR1)
4325-
self.assertEqual(conn.recv_bytes(), b'x' * support.PIPE_MAX_SIZE)
4328+
self.assertEqual(conn.recv_bytes(), b'x' * self.CONN_MAX_SIZE)
43264329
time.sleep(0.1)
43274330
p.join()
43284331
finally:

0 commit comments

Comments
 (0)