code: def test_threaded_poll(self):
      r, w = os.pipe()
      self.addCleanup(os.close, r)
      self.addCleanup(os.close, w)
      rfds = []
      for i in range(10):
          fd = os.dup(r)
          self.addCleanup(os.close, fd)
          rfds.append(fd)
      pollster = select.poll()
      for fd in rfds:
          pollster.register(fd, select.POLLIN)
  
      t = threading.Thread(target=pollster.poll)
      t.start()
      try:
          time.sleep(0.5)
          # trigger ufds array reallocation
          for fd in rfds:
              pollster.unregister(fd)
          pollster.register(w, select.POLLOUT)
          self.assertRaises(RuntimeError, pollster.poll)
      finally:
          # and make the call to poll() from the thread return
          os.write(w, b"spam")
          t.join()
  
file_path: cpython/Lib/test/test_poll.py
imports: import os
  import subprocess
  import random
  import select
  import threading
  import time
  import unittest
  from test.support import cpython_only, requires_subprocess, requires_working_socket, requires_resource
  from test.support import threading_helper
  from test.support.os_helper import TESTFN
label_desc: Use image node_id 6 for calling the PollTests obj's underlying member method code with example usage: obj.test_threaded_poll() without return types