Close #18794: Add a fileno() method and a closed attribute to select.devpoll
objects.

Add also tests on fileno() method and closed attribute of select.epoll and select.kqueue.
diff --git a/Lib/test/test_epoll.py b/Lib/test/test_epoll.py
index 7077a70..93a9e1d 100644
--- a/Lib/test/test_epoll.py
+++ b/Lib/test/test_epoll.py
@@ -225,6 +225,31 @@
         server.close()
         ep.unregister(fd)
 
+    def test_close(self):
+        open_file = open(__file__, "rb")
+        self.addCleanup(open_file.close)
+        fd = open_file.fileno()
+        epoll = select.epoll()
+
+        # test fileno() method and closed attribute
+        self.assertIsInstance(epoll.fileno(), int)
+        self.assertFalse(epoll.closed)
+
+        # test close()
+        epoll.close()
+        self.assertTrue(epoll.closed)
+        self.assertRaises(ValueError, epoll.fileno)
+
+        # close() can be called more than once
+        epoll.close()
+
+        # operations must fail with ValueError("I/O operation on closed ...")
+        self.assertRaises(ValueError, epoll.modify, fd, select.EPOLLIN)
+        self.assertRaises(ValueError, epoll.poll, 1.0)
+        self.assertRaises(ValueError, epoll.register, fd, select.EPOLLIN)
+        self.assertRaises(ValueError, epoll.unregister, fd)
+
+
 def test_main():
     support.run_unittest(TestEPoll)