[Python-checkins] bpo-36894: Fix regression in test_multiprocessing_spawn (no tests run on Windows) (GH-13290)

Antoine Pitrou webhook-mailer at python.org
Mon May 13 14:02:53 EDT 2019


https://github.com/python/cpython/commit/95da83d9bac698d420cc308e8699ef6e4fae2aca
commit: 95da83d9bac698d420cc308e8699ef6e4fae2aca
branch: master
author: Antoine Pitrou <antoine at python.org>
committer: GitHub <noreply at github.com>
date: 2019-05-13T20:02:46+02:00
summary:

bpo-36894: Fix regression in test_multiprocessing_spawn (no tests run on Windows) (GH-13290)

files:
M Lib/multiprocessing/resource_tracker.py

diff --git a/Lib/multiprocessing/resource_tracker.py b/Lib/multiprocessing/resource_tracker.py
index e67e0b213eb9..61a6dd66e72e 100644
--- a/Lib/multiprocessing/resource_tracker.py
+++ b/Lib/multiprocessing/resource_tracker.py
@@ -20,8 +20,6 @@
 import sys
 import threading
 import warnings
-import _multiprocessing
-import _posixshmem
 
 from . import spawn
 from . import util
@@ -33,10 +31,17 @@
 
 _CLEANUP_FUNCS = {
     'noop': lambda: None,
-    'semaphore': _multiprocessing.sem_unlink,
-    'shared_memory': _posixshmem.shm_unlink
 }
 
+if os.name == 'posix':
+    import _multiprocessing
+    import _posixshmem
+
+    _CLEANUP_FUNCS.update({
+        'semaphore': _multiprocessing.sem_unlink,
+        'shared_memory': _posixshmem.shm_unlink,
+    })
+
 
 class ResourceTracker(object):
 



More information about the Python-checkins mailing list