Issue #20990: Fix issues found by pyflakes for multiprocessing.
diff --git a/Lib/multiprocessing/synchronize.py b/Lib/multiprocessing/synchronize.py
index 0e3f6ec..dea1cbd 100644
--- a/Lib/multiprocessing/synchronize.py
+++ b/Lib/multiprocessing/synchronize.py
@@ -49,9 +49,10 @@
_rand = tempfile._RandomNameSequence()
def __init__(self, kind, value, maxvalue, *, ctx):
- ctx = ctx or get_context()
- ctx = ctx.get_context()
- unlink_now = sys.platform == 'win32' or ctx._name == 'fork'
+ if ctx is None:
+ ctx = context._default_context.get_context()
+ name = ctx.get_start_method()
+ unlink_now = sys.platform == 'win32' or name == 'fork'
for i in range(100):
try:
sl = self._semlock = _multiprocessing.SemLock(