mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
Change always_forkserver_on_unix()
to use_multiprocessing_forkserver_on_linux()
(#4577)
This commit is contained in:
parent
c4c15d4b10
commit
cf7d2e6f15
@ -8,8 +8,8 @@ import contextlib
|
|||||||
import difflib
|
import difflib
|
||||||
import gc
|
import gc
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
@ -25,8 +25,9 @@ except Exception:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session", autouse=True)
|
@pytest.fixture(scope="session", autouse=True)
|
||||||
def always_forkserver_on_unix():
|
def use_multiprocessing_forkserver_on_linux():
|
||||||
if os.name == "nt":
|
if sys.platform != "linux":
|
||||||
|
# The default on Windows and macOS is "spawn": If it's not broken, don't fix it.
|
||||||
return
|
return
|
||||||
|
|
||||||
# Full background: https://github.com/pybind/pybind11/issues/4105#issuecomment-1301004592
|
# Full background: https://github.com/pybind/pybind11/issues/4105#issuecomment-1301004592
|
||||||
@ -34,8 +35,6 @@ def always_forkserver_on_unix():
|
|||||||
# It is actually a well-known pitfall, unfortunately without guard rails.
|
# It is actually a well-known pitfall, unfortunately without guard rails.
|
||||||
# "forkserver" is more performant than "spawn" (~9s vs ~13s for tests/test_gil_scoped.py,
|
# "forkserver" is more performant than "spawn" (~9s vs ~13s for tests/test_gil_scoped.py,
|
||||||
# visit the issuecomment link above for details).
|
# visit the issuecomment link above for details).
|
||||||
# Windows does not have fork() and the associated pitfall, therefore it is best left
|
|
||||||
# running with defaults.
|
|
||||||
multiprocessing.set_start_method("forkserver")
|
multiprocessing.set_start_method("forkserver")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user