def exhaust(self):
        """
        Open file descriptors until C{EMFILE} is reached.
        """
        # Force a collection to close dangling files.
        gc.collect()
        try:
            while True:
                try:
                    fd = self._fileDescriptorFactory()
                except (IOError, OSError) as e:
                    if e.errno == errno.EMFILE:
                        break
                    raise
                else:
                    self._fileDescriptors.append(fd)
        except Exception:
            self.release()
            raise
        else:
            self._log.info(
                "EMFILE reached by opening"
                " {openedFileDescriptors} file descriptors.",
                openedFileDescriptors=self.count(),
            )

        Open file descriptors until C{EMFILE} is reached.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_tcp.py