summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <antoine@python.org>2019-05-13 18:02:46 (GMT)
committerGitHub <noreply@github.com>2019-05-13 18:02:46 (GMT)
commit95da83d9bac698d420cc308e8699ef6e4fae2aca (patch)
tree82db238b19f2c2f216be159ebf5cb716e5c20984 /Lib
parent50466c66509de556a8579172f82d1abb1560d8e4 (diff)
downloadcpython-95da83d9bac698d420cc308e8699ef6e4fae2aca.zip
cpython-95da83d9bac698d420cc308e8699ef6e4fae2aca.tar.gz
cpython-95da83d9bac698d420cc308e8699ef6e4fae2aca.tar.bz2
bpo-36894: Fix regression in test_multiprocessing_spawn (no tests run on Windows) (GH-13290)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/multiprocessing/resource_tracker.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/multiprocessing/resource_tracker.py b/Lib/multiprocessing/resource_tracker.py
index e67e0b2..61a6dd6 100644
--- a/Lib/multiprocessing/resource_tracker.py
+++ b/Lib/multiprocessing/resource_tracker.py
@@ -20,8 +20,6 @@ import signal
import sys
import threading
import warnings
-import _multiprocessing
-import _posixshmem
from . import spawn
from . import util
@@ -33,10 +31,17 @@ _IGNORED_SIGNALS = (signal.SIGINT, signal.SIGTERM)
_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):