Revert "gh-87079: Warn on unintended signal wakeup fd override in asyncio (#96807)" (#96898)

This reverts commit 0587810698.
Reason: This broke buildbots (some warnings added by that commit are turned to errors in the SSL buildbot).
Repro:  ./python Lib/test/ssltests.py
This commit is contained in:
Guido van Rossum 2022-09-17 14:12:45 -07:00 committed by GitHub
parent 7e36abbb78
commit 487135a396
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 66 deletions

View file

@ -720,12 +720,8 @@ class BaseProactorEventLoopTests(test_utils.TestCase):
def test_ctor(self, socketpair):
ssock, csock = socketpair.return_value = (
mock.Mock(), mock.Mock())
with mock.patch('signal.set_wakeup_fd') as set_wakeup_fd:
set_wakeup_fd.return_value = -1000
with self.assertWarnsRegex(
ResourceWarning, 'Signal wakeup fd was already set'
):
loop = BaseProactorEventLoop(self.proactor)
with mock.patch('signal.set_wakeup_fd'):
loop = BaseProactorEventLoop(self.proactor)
self.assertIs(loop._ssock, ssock)
self.assertIs(loop._csock, csock)
self.assertEqual(loop._internal_fds, 1)
@ -744,12 +740,7 @@ class BaseProactorEventLoopTests(test_utils.TestCase):
def test_close(self):
self.loop._close_self_pipe = mock.Mock()
with mock.patch('signal.set_wakeup_fd') as set_wakeup_fd:
set_wakeup_fd.return_value = -1000
with self.assertWarnsRegex(
ResourceWarning, 'Got unexpected signal wakeup fd'
):
self.loop.close()
self.loop.close()
self.assertTrue(self.loop._close_self_pipe.called)
self.assertTrue(self.proactor.close.called)
self.assertIsNone(self.loop._proactor)

View file

@ -88,17 +88,6 @@ class SelectorEventLoopSignalTests(test_utils.TestCase):
self.loop.add_signal_handler,
signal.SIGINT, lambda: True)
@mock.patch('asyncio.unix_events.signal')
def test_add_signal_handler_setup_warn(self, m_signal):
m_signal.NSIG = signal.NSIG
m_signal.valid_signals = signal.valid_signals
m_signal.set_wakeup_fd.return_value = -1000
with self.assertWarnsRegex(
ResourceWarning, 'Signal wakeup fd was already set'
):
self.loop.add_signal_handler(signal.SIGINT, lambda: True)
@mock.patch('asyncio.unix_events.signal')
def test_add_signal_handler_coroutine_error(self, m_signal):
m_signal.NSIG = signal.NSIG
@ -224,19 +213,6 @@ class SelectorEventLoopSignalTests(test_utils.TestCase):
self.loop.remove_signal_handler(signal.SIGHUP)
self.assertTrue(m_logging.info)
@mock.patch('asyncio.unix_events.signal')
def test_remove_signal_handler_cleanup_warn(self, m_signal):
m_signal.NSIG = signal.NSIG
m_signal.valid_signals = signal.valid_signals
self.loop.add_signal_handler(signal.SIGHUP, lambda: True)
m_signal.set_wakeup_fd.return_value = -1000
with self.assertWarnsRegex(
ResourceWarning, 'Got unexpected signal wakeup fd'
):
self.loop.remove_signal_handler(signal.SIGHUP)
@mock.patch('asyncio.unix_events.signal')
def test_remove_signal_handler_error(self, m_signal):
m_signal.NSIG = signal.NSIG