Skip to content

Commit 95da83d

Browse files
authored
bpo-36894: Fix regression in test_multiprocessing_spawn (no tests run on Windows) (GH-13290)
1 parent 50466c6 commit 95da83d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Lib/multiprocessing/resource_tracker.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import sys
2121
import threading
2222
import warnings
23-
import _multiprocessing
24-
import _posixshmem
2523

2624
from . import spawn
2725
from . import util
@@ -33,10 +31,17 @@
3331

3432
_CLEANUP_FUNCS = {
3533
'noop': lambda: None,
36-
'semaphore': _multiprocessing.sem_unlink,
37-
'shared_memory': _posixshmem.shm_unlink
3834
}
3935

36+
if os.name == 'posix':
37+
import _multiprocessing
38+
import _posixshmem
39+
40+
_CLEANUP_FUNCS.update({
41+
'semaphore': _multiprocessing.sem_unlink,
42+
'shared_memory': _posixshmem.shm_unlink,
43+
})
44+
4045

4146
class ResourceTracker(object):
4247

0 commit comments

Comments
 (0)