From 725c58afab209928b7f4521753dc565e0671ef9f Mon Sep 17 00:00:00 2001 From: Ido Michael Date: Sun, 23 Feb 2020 10:05:38 -0500 Subject: [PATCH 01/11] Added macos case + test --- Lib/multiprocessing/context.py | 2 ++ Lib/test/_test_multiprocessing.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index 5f8e0f0cd46585..67f3993c2e9dff 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -256,6 +256,8 @@ def get_start_method(self, allow_none=False): def get_all_start_methods(self): if sys.platform == 'win32': return ['spawn'] + elif sys.platform == 'darwin': + return ['spawn', 'fork', 'forkserver'] else: if reduction.HAVE_SEND_HANDLE: return ['fork', 'spawn', 'forkserver'] diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 73dc75d34a6f01..f63aa95fffa804 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -4991,6 +4991,8 @@ def test_get_all(self): methods = multiprocessing.get_all_start_methods() if sys.platform == 'win32': self.assertEqual(methods, ['spawn']) + elif sys.platform == 'darwin': + self.assertEqual(methods, ['spawn', 'fork', 'forkserver']) else: self.assertTrue(methods == ['fork', 'spawn'] or methods == ['fork', 'spawn', 'forkserver']) From 33db325f9d3c76c20a315864910f5b36d562b5ee Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Sun, 23 Feb 2020 15:09:48 +0000 Subject: [PATCH 02/11] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20b?= =?UTF-8?q?lurb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst diff --git a/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst b/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst new file mode 100644 index 00000000000000..af0191187dbb14 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst @@ -0,0 +1,2 @@ +Fixed :class:`multiprocessing.context` :method: `get_all_start_methods` +If the context is macOS, return the default 'spawn' \ No newline at end of file From bfa8032dd7e269f7812c79050a170478b80e3379 Mon Sep 17 00:00:00 2001 From: idomic Date: Sun, 1 Mar 2020 11:55:41 -0500 Subject: [PATCH 03/11] Update 2020-02-23-15-09-47.bpo-39244.aBK5IM.rst --- .../next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst b/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst index af0191187dbb14..e1552e1112c7ab 100644 --- a/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst +++ b/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst @@ -1,2 +1,2 @@ -Fixed :class:`multiprocessing.context` :method: `get_all_start_methods` -If the context is macOS, return the default 'spawn' \ No newline at end of file +Fixed :method:`multiprocessing.context.get_all_start_methods` +If the context is macOS, return the default methods by order. From c43f6c412d8c39dbff1bdbf38b1bf816589d860c Mon Sep 17 00:00:00 2001 From: idomic Date: Sun, 1 Mar 2020 12:02:20 -0500 Subject: [PATCH 04/11] Update 2020-02-23-15-09-47.bpo-39244.aBK5IM.rst --- .../next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst b/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst index e1552e1112c7ab..8e2e8a63416a2f 100644 --- a/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst +++ b/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst @@ -1,2 +1,2 @@ -Fixed :method:`multiprocessing.context.get_all_start_methods` +Fixed :class:`multiprocessing.context.get_all_start_methods` If the context is macOS, return the default methods by order. From 761870046f85f5ead48f5ce67c0cea7fee249807 Mon Sep 17 00:00:00 2001 From: Ido Michael Date: Sun, 22 Mar 2020 17:20:50 -0400 Subject: [PATCH 05/11] Moved statement and pulled master --- Lib/multiprocessing/context.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index 67f3993c2e9dff..c8b0221c9fbcb9 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -256,11 +256,12 @@ def get_start_method(self, allow_none=False): def get_all_start_methods(self): if sys.platform == 'win32': return ['spawn'] - elif sys.platform == 'darwin': - return ['spawn', 'fork', 'forkserver'] else: if reduction.HAVE_SEND_HANDLE: - return ['fork', 'spawn', 'forkserver'] + if sys.platform == 'darwin': + return ['spawn', 'fork', 'forkserver'] + else: + return ['fork', 'spawn', 'forkserver'] else: return ['fork', 'spawn'] From 872545c3f65c32d50f2b6c353e5ba76e840484c6 Mon Sep 17 00:00:00 2001 From: Ido Michael Date: Sun, 17 May 2020 16:17:22 -0400 Subject: [PATCH 06/11] Fixed comments for code and tests --- Lib/multiprocessing/context.py | 2 +- Lib/test/_test_multiprocessing.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index c8b0221c9fbcb9..17bf530d8790a9 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -263,7 +263,7 @@ def get_all_start_methods(self): else: return ['fork', 'spawn', 'forkserver'] else: - return ['fork', 'spawn'] + return ['fork', 'spawn', 'forkserver'] # # Context types for fixed start method diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 20303ee967ca88..dc8164f3288e1b 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -5037,8 +5037,6 @@ def test_get_all(self): methods = multiprocessing.get_all_start_methods() if sys.platform == 'win32': self.assertEqual(methods, ['spawn']) - elif sys.platform == 'darwin': - self.assertEqual(methods, ['spawn', 'fork', 'forkserver']) else: self.assertTrue(methods == ['fork', 'spawn'] or methods == ['fork', 'spawn', 'forkserver']) From da6f5048b495fd070163073f7da4e18736337d06 Mon Sep 17 00:00:00 2001 From: Ido Michael Date: Sun, 24 May 2020 18:12:54 -0400 Subject: [PATCH 07/11] Fixing tests --- Lib/multiprocessing/context.py | 8 +++----- Lib/test/_test_multiprocessing.py | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index 17bf530d8790a9..619fa95d0f0ede 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -257,14 +257,12 @@ def get_all_start_methods(self): if sys.platform == 'win32': return ['spawn'] else: + if sys.platform == 'darwin': + return ['spawn', 'fork', 'forkserver'] if reduction.HAVE_SEND_HANDLE: - if sys.platform == 'darwin': - return ['spawn', 'fork', 'forkserver'] - else: - return ['fork', 'spawn', 'forkserver'] - else: return ['fork', 'spawn', 'forkserver'] + # # Context types for fixed start method # diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index dc8164f3288e1b..3eb7fcff9dfa8e 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -5037,6 +5037,8 @@ def test_get_all(self): methods = multiprocessing.get_all_start_methods() if sys.platform == 'win32': self.assertEqual(methods, ['spawn']) + elif sys.platform == 'darwin': + self.assertEqual(methods, ['spawn', 'fork']) else: self.assertTrue(methods == ['fork', 'spawn'] or methods == ['fork', 'spawn', 'forkserver']) From 95cd489855dfa2ffafa85fbf30936042aca1f93f Mon Sep 17 00:00:00 2001 From: Ido Michael Date: Sun, 24 May 2020 18:42:14 -0400 Subject: [PATCH 08/11] Fixing tests --- Lib/test/_test_multiprocessing.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 3eb7fcff9dfa8e..441aa2cac1f345 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -5037,11 +5037,10 @@ def test_get_all(self): methods = multiprocessing.get_all_start_methods() if sys.platform == 'win32': self.assertEqual(methods, ['spawn']) - elif sys.platform == 'darwin': - self.assertEqual(methods, ['spawn', 'fork']) else: self.assertTrue(methods == ['fork', 'spawn'] or - methods == ['fork', 'spawn', 'forkserver']) + methods == ['fork', 'spawn', 'forkserver'] or + methods == ['spawn', 'fork', 'forkserver']) def test_preload_resources(self): if multiprocessing.get_start_method() != 'forkserver': From 9bf71dd5d5bce49662703deb2b58a86a5c340e78 Mon Sep 17 00:00:00 2001 From: Ido Michael Date: Mon, 25 May 2020 10:06:18 -0400 Subject: [PATCH 09/11] Fixing tests --- Lib/multiprocessing/context.py | 4 ++-- .../next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index 619fa95d0f0ede..a9e88c91c6dcc2 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -257,10 +257,10 @@ def get_all_start_methods(self): if sys.platform == 'win32': return ['spawn'] else: - if sys.platform == 'darwin': - return ['spawn', 'fork', 'forkserver'] if reduction.HAVE_SEND_HANDLE: return ['fork', 'spawn', 'forkserver'] + if sys.platform == 'darwin': + return ['spawn', 'fork', 'forkserver'] # diff --git a/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst b/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst index 8e2e8a63416a2f..580446ed039e05 100644 --- a/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst +++ b/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst @@ -1,2 +1,2 @@ Fixed :class:`multiprocessing.context.get_all_start_methods` -If the context is macOS, return the default methods by order. +If the context is macOS, return the default method first. From 7db96d515a4febadc7714a2f5ea53f8551665789 Mon Sep 17 00:00:00 2001 From: Ido Michael Date: Mon, 25 May 2020 10:45:47 -0400 Subject: [PATCH 10/11] Added Tal's commit --- Lib/multiprocessing/context.py | 6 +++--- Lib/test/_test_multiprocessing.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Lib/multiprocessing/context.py b/Lib/multiprocessing/context.py index a9e88c91c6dcc2..8d0525d5d62179 100644 --- a/Lib/multiprocessing/context.py +++ b/Lib/multiprocessing/context.py @@ -257,10 +257,10 @@ def get_all_start_methods(self): if sys.platform == 'win32': return ['spawn'] else: + methods = ['spawn', 'fork'] if sys.platform == 'darwin' else ['fork', 'spawn'] if reduction.HAVE_SEND_HANDLE: - return ['fork', 'spawn', 'forkserver'] - if sys.platform == 'darwin': - return ['spawn', 'fork', 'forkserver'] + methods.append('forkserver') + return methods # diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py index 441aa2cac1f345..155a8276e75078 100644 --- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -5039,6 +5039,7 @@ def test_get_all(self): self.assertEqual(methods, ['spawn']) else: self.assertTrue(methods == ['fork', 'spawn'] or + methods == ['spawn', 'fork'] or methods == ['fork', 'spawn', 'forkserver'] or methods == ['spawn', 'fork', 'forkserver']) From 341fd7939a9512a57afb18b70dafdc8584ca876e Mon Sep 17 00:00:00 2001 From: Tal Einat Date: Tue, 26 May 2020 17:21:23 +0300 Subject: [PATCH 11/11] Update 2020-02-23-15-09-47.bpo-39244.aBK5IM.rst --- .../next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst b/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst index 580446ed039e05..c7d8e0de676b5c 100644 --- a/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst +++ b/Misc/NEWS.d/next/Library/2020-02-23-15-09-47.bpo-39244.aBK5IM.rst @@ -1,2 +1,2 @@ Fixed :class:`multiprocessing.context.get_all_start_methods` -If the context is macOS, return the default method first. +to properly return the default method first on macOS.