| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0aa59ce commit 9eb50a4
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,7 +50,7 @@ | |||
| 50 | 50 | default_family = 'AF_INET' | |
| 51 | 51 | families = ['AF_INET'] | |
| 52 | 52 | ||
| 53 | - if hasattr(socket, 'AF_UNIX'): | ||
| 53 | + if hasattr(socket, 'AF_UNIX') and sys.platform != 'cygwin': | ||
| 54 | 54 | default_family = 'AF_UNIX' | |
| 55 | 55 | families += ['AF_UNIX'] | |
| 56 | 56 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -326,8 +326,10 @@ def _check_available(self): | |||
| 326 | 326 | _concrete_contexts = { | |
| 327 | 327 | 'fork': ForkContext(), | |
| 328 | 328 | 'spawn': SpawnContext(), | |
| 329 | - 'forkserver': ForkServerContext(), | ||
| 330 | 329 | } | |
| 330 | + if reduction.HAVE_SEND_HANDLE: | ||
| 331 | + _concrete_contexts['forkserver'] = ForkServerContext() | ||
| 332 | + | ||
| 331 | 333 | # bpo-33725: running arbitrary code after fork() is no longer reliable | |
| 332 | 334 | # on macOS since macOS 10.14 (Mojave). Use spawn by default instead. | |
| 333 | 335 | # gh-84559: We changed everyones default to a thread safeish one in 3.14. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6143,7 +6143,10 @@ def test_preload_resources(self): | |||
| 6143 | 6143 | @only_run_in_spawn_testsuite("avoids redundant testing.") | |
| 6144 | 6144 | def test_mixed_startmethod(self): | |
| 6145 | 6145 | # Fork-based locks cannot be used with spawned process | |
| 6146 | - for process_method in ["spawn", "forkserver"]: | ||
| 6146 | + test_methods = ["spawn"] | ||
| 6147 | + if "forkserver" in multiprocessing.get_all_start_methods(): | ||
| 6148 | + test_methods.append("forkserver") | ||
| 6149 | + for process_method in test_methods: | ||
| 6147 | 6150 | queue = multiprocessing.get_context("fork").Queue() | |
| 6148 | 6151 | process_ctx = multiprocessing.get_context(process_method) | |
| 6149 | 6152 | p = process_ctx.Process(target=close_queue, args=(queue,)) | |
@@ -6152,7 +6155,7 @@ def test_mixed_startmethod(self): | |||
| 6152 | 6155 | p.start() | |
| 6153 | 6156 | ||
| 6154 | 6157 | # non-fork-based locks can be used with all other start methods | |
| 6155 | - for queue_method in ["spawn", "forkserver"]: | ||
| 6158 | + for queue_method in test_methods: | ||
| 6156 | 6159 | for process_method in multiprocessing.get_all_start_methods(): | |
| 6157 | 6160 | queue = multiprocessing.get_context(queue_method).Queue() | |
| 6158 | 6161 | process_ctx = multiprocessing.get_context(process_method) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4065,11 +4065,7 @@ def test_config_reject_simple_queue_handler_multiprocessing_context(self): | |||
| 4065 | 4065 | # and thus cannot be used as a queue-like object (gh-124653) | |
| 4066 | 4066 | ||
| 4067 | 4067 | import multiprocessing | |
| 4068 | - | ||
| 4069 | - if support.MS_WINDOWS: | ||
| 4070 | - start_methods = ['spawn'] | ||
| 4071 | - else: | ||
| 4072 | - start_methods = ['spawn', 'fork', 'forkserver'] | ||
| 4068 | + start_methods = multiprocessing.get_all_start_methods() | ||
| 4073 | 4069 | ||
| 4074 | 4070 | for start_method in start_methods: | |
| 4075 | 4071 | with self.subTest(start_method=start_method): | |
@@ -4085,10 +4081,8 @@ def test_config_reject_simple_queue_handler_multiprocessing_context(self): | |||
| 4085 | 4081 | " assertions in multiprocessing") | |
| 4086 | 4082 | def test_config_queue_handler_multiprocessing_context(self): | |
| 4087 | 4083 | # regression test for gh-121723 | |
| 4088 | - if support.MS_WINDOWS: | ||
| 4089 | - start_methods = ['spawn'] | ||
| 4090 | - else: | ||
| 4091 | - start_methods = ['spawn', 'fork', 'forkserver'] | ||
| 4084 | + import multiprocessing | ||
| 4085 | + start_methods = multiprocessing.get_all_start_methods() | ||
| 4092 | 4086 | for start_method in start_methods: | |
| 4093 | 4087 | with self.subTest(start_method=start_method): | |
| 4094 | 4088 | ctx = multiprocessing.get_context(start_method) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,7 @@ | |||
| 6 | 6 | if support.PGO: | |
| 7 | 7 | raise unittest.SkipTest("test is not helpful for PGO") | |
| 8 | 8 | ||
| 9 | - if sys.platform == "win32": | ||
| 9 | + if sys.platform in ("win32", "cygwin"): | ||
| 10 | 10 | raise unittest.SkipTest("forkserver is not available on Windows") | |
| 11 | 11 | ||
| 12 | 12 | if not support.has_fork_support: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments