File tree 1 file changed +4
-5
lines changed
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 8
8
import difflib
9
9
import gc
10
10
import multiprocessing
11
- import os
12
11
import re
12
+ import sys
13
13
import textwrap
14
14
import traceback
15
15
25
25
26
26
27
27
@pytest .fixture (scope = "session" , autouse = True )
28
- def always_forkserver_on_unix ():
29
- if os .name == "nt" :
28
+ def use_multiprocessing_forkserver_on_linux ():
29
+ if sys .platform != "linux" :
30
+ # The default on Windows and macOS is "spawn": If it's not broken, don't fix it.
30
31
return
31
32
32
33
# Full background: https://github.com/pybind/pybind11/issues/4105#issuecomment-1301004592
33
34
# In a nutshell: fork() after starting threads == flakiness in the form of deadlocks.
34
35
# It is actually a well-known pitfall, unfortunately without guard rails.
35
36
# "forkserver" is more performant than "spawn" (~9s vs ~13s for tests/test_gil_scoped.py,
36
37
# visit the issuecomment link above for details).
37
- # Windows does not have fork() and the associated pitfall, therefore it is best left
38
- # running with defaults.
39
38
multiprocessing .set_start_method ("forkserver" )
40
39
41
40
You can’t perform that action at this time.
0 commit comments