Use select.poll() in subprocess, when available, rather than select() so that
it does not fail when file descriptors are large.  Fixes issue3392.

Patch largely contributed by Frank Chu (fpmc) with some improvements by me.
See http://bugs.python.org/issue3392.

Candidate for backporting to release26-maint as it is a bug fix and changes no
public API.
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index c441cdc..5add023 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -766,8 +766,24 @@
             p.terminate()
             self.assertNotEqual(p.wait(), 0)
 
+
+unit_tests = [ProcessTestCase]
+
+if subprocess._has_poll:
+    class ProcessTestCaseNoPoll(ProcessTestCase):
+        def setUp(self):
+            subprocess._has_poll = False
+            ProcessTestCase.setUp(self)
+
+        def tearDown(self):
+            subprocess._has_poll = True
+            ProcessTestCase.tearDown(self)
+
+    unit_tests.append(ProcessTestCaseNoPoll)
+
+
 def test_main():
-    test_support.run_unittest(ProcessTestCase)
+    test_support.run_unittest(*unit_tests)
     if hasattr(test_support, "reap_children"):
         test_support.reap_children()