File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88import difflib
99import gc
1010import multiprocessing
11- import os
1211import re
12+ import sys
1313import textwrap
1414import traceback
1515
2525
2626
2727@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.
3031 return
3132
3233 # Full background: https://github.com/pybind/pybind11/issues/4105#issuecomment-1301004592
3334 # In a nutshell: fork() after starting threads == flakiness in the form of deadlocks.
3435 # It is actually a well-known pitfall, unfortunately without guard rails.
3536 # "forkserver" is more performant than "spawn" (~9s vs ~13s for tests/test_gil_scoped.py,
3637 # 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.
3938 multiprocessing .set_start_method ("forkserver" )
4039
4140
You can’t perform that action at this time.
0 commit comments