bpo-36894: Fix regression in test_multiprocessing_spawn (no tests run… · python/cpython@95da83d

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