We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c4d381f commit 44a1257Copy full SHA for 44a1257
1 file changed
src/freethreading/__init__.py
@@ -88,7 +88,7 @@ def get_backend() -> Literal["threading", "multiprocessing"]:
88
Literal['threading', 'multiprocessing']
89
'threading' when GIL is disabled, and 'multiprocessing' otherwise.
90
"""
91
- if sys._is_gil_enabled() if hasattr(sys, "_is_gil_enabled") else True:
+ if getattr(sys, "_is_gil_enabled", lambda: True)():
92
return "multiprocessing"
93
return "threading"
94
@@ -108,7 +108,7 @@ def _get_mp_context():
108
raise AssertionError(
109
"Attempting to get multiprocessing context while on threading backend"
110
)
111
- if sys.platform == "win32" or sys.platform == "darwin":
+ if sys.platform in ("win32", "darwin"):
112
return get_context("spawn")
113
return get_context("forkserver")
114
0 commit comments