asyncio: Add close() back to Unix selector event loop, to remove all signal handlers. Should fix buildbot issues.
diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py
index dd57fe8..f4cf6e7 100644
--- a/Lib/asyncio/unix_events.py
+++ b/Lib/asyncio/unix_events.py
@@ -48,6 +48,11 @@
     def _socketpair(self):
         return socket.socketpair()
 
+    def close(self):
+        for sig in list(self._signal_handlers):
+            self.remove_signal_handler(sig)
+        super().close()
+
     def add_signal_handler(self, sig, callback, *args):
         """Add a handler for a signal.  UNIX only.
 
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index a4d835e..42eba8d 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -183,6 +183,22 @@
         self.assertRaises(
             RuntimeError, self.loop.remove_signal_handler, signal.SIGHUP)
 
+    @unittest.mock.patch('asyncio.unix_events.signal')
+    def test_close(self, m_signal):
+        m_signal.NSIG = signal.NSIG
+
+        self.loop.add_signal_handler(signal.SIGHUP, lambda: True)
+        self.loop.add_signal_handler(signal.SIGCHLD, lambda: True)
+
+        self.assertEqual(len(self.loop._signal_handlers), 2)
+
+        m_signal.set_wakeup_fd.reset_mock()
+
+        self.loop.close()
+
+        self.assertEqual(len(self.loop._signal_handlers), 0)
+        m_signal.set_wakeup_fd.assert_called_once_with(-1)
+
 
 class UnixReadPipeTransportTests(unittest.TestCase):