Revert "gh-127586: properly restore blocked signals in resource_tracker.py (GH-127587)" (#127983)
This reverts commit 46006a1b355f75d06c10e7b8086912c483b34487.
This commit is contained in:
parent
e4981e33b8
commit
1d276ec6f8
@ -155,14 +155,13 @@ class ResourceTracker(object):
|
|||||||
# that can make the child die before it registers signal handlers
|
# that can make the child die before it registers signal handlers
|
||||||
# for SIGINT and SIGTERM. The mask is unregistered after spawning
|
# for SIGINT and SIGTERM. The mask is unregistered after spawning
|
||||||
# the child.
|
# the child.
|
||||||
prev_sigmask = None
|
|
||||||
try:
|
try:
|
||||||
if _HAVE_SIGMASK:
|
if _HAVE_SIGMASK:
|
||||||
prev_sigmask = signal.pthread_sigmask(signal.SIG_BLOCK, _IGNORED_SIGNALS)
|
signal.pthread_sigmask(signal.SIG_BLOCK, _IGNORED_SIGNALS)
|
||||||
pid = util.spawnv_passfds(exe, args, fds_to_pass)
|
pid = util.spawnv_passfds(exe, args, fds_to_pass)
|
||||||
finally:
|
finally:
|
||||||
if prev_sigmask is not None:
|
if _HAVE_SIGMASK:
|
||||||
signal.pthread_sigmask(signal.SIG_SETMASK, prev_sigmask)
|
signal.pthread_sigmask(signal.SIG_UNBLOCK, _IGNORED_SIGNALS)
|
||||||
except:
|
except:
|
||||||
os.close(w)
|
os.close(w)
|
||||||
raise
|
raise
|
||||||
|
@ -6044,21 +6044,6 @@ class TestResourceTracker(unittest.TestCase):
|
|||||||
self._test_resource_tracker_leak_resources(
|
self._test_resource_tracker_leak_resources(
|
||||||
cleanup=cleanup,
|
cleanup=cleanup,
|
||||||
)
|
)
|
||||||
@unittest.skipUnless(hasattr(signal, "pthread_sigmask"), "pthread_sigmask is not available")
|
|
||||||
def test_resource_tracker_blocked_signals(self):
|
|
||||||
#
|
|
||||||
# gh-127586: Check that resource_tracker does not override blocked signals of caller.
|
|
||||||
#
|
|
||||||
from multiprocessing.resource_tracker import ResourceTracker
|
|
||||||
signals = {signal.SIGTERM, signal.SIGINT, signal.SIGUSR1}
|
|
||||||
|
|
||||||
for sig in signals:
|
|
||||||
signal.pthread_sigmask(signal.SIG_SETMASK, {sig})
|
|
||||||
self.assertEqual(signal.pthread_sigmask(signal.SIG_BLOCK, set()), {sig})
|
|
||||||
tracker = ResourceTracker()
|
|
||||||
tracker.ensure_running()
|
|
||||||
self.assertEqual(signal.pthread_sigmask(signal.SIG_BLOCK, set()), {sig})
|
|
||||||
tracker._stop()
|
|
||||||
|
|
||||||
class TestSimpleQueue(unittest.TestCase):
|
class TestSimpleQueue(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
:class:`multiprocessing.pool.Pool` now properly restores blocked signal handlers
|
|
||||||
of the parent thread when creating processes via either *spawn* or
|
|
||||||
*forkserver*.
|
|
Loading…
x
Reference in New Issue
Block a user