File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -668,6 +668,7 @@ def __init__(self):
668
668
self ._local = self ._Local ()
669
669
if hasattr (os , 'fork' ):
670
670
def on_fork ():
671
+ # Reset the loop and wakeupfd in the forked child process.
671
672
self ._local = self ._Local ()
672
673
signal .set_wakeup_fd (- 1 )
673
674
Original file line number Diff line number Diff line change @@ -1873,7 +1873,8 @@ async def runner():
1873
1873
@unittest .skipUnless (hasattr (os , 'fork' ), 'requires os.fork()' )
1874
1874
class TestFork (unittest .IsolatedAsyncioTestCase ):
1875
1875
1876
- async def test_fork (self ):
1876
+ async def test_fork_not_share_event_loop (self ):
1877
+ # The forked process should not share the event loop with the parent
1877
1878
loop = asyncio .get_running_loop ()
1878
1879
r , w = os .pipe ()
1879
1880
self .addCleanup (os .close , r )
@@ -1893,6 +1894,8 @@ async def test_fork(self):
1893
1894
wait_process (pid , exitcode = 0 )
1894
1895
1895
1896
def test_fork_signal_handling (self ):
1897
+ # Sending signals to the forked process should not affect the parent
1898
+ # process.
1896
1899
multiprocessing .set_start_method ('fork' )
1897
1900
manager = multiprocessing .Manager ()
1898
1901
self .addCleanup (manager .shutdown )
You can’t perform that action at this time.
0 commit comments