available bytes from the "self pipe", not only a single byte. This change
reduces the risk of having the pipe full and so getting the innocuous
"BlockingIOError: [Errno 11] Resource temporarily unavailable" message.
self.add_reader(self._ssock.fileno(), self._read_from_self)
def _read_from_self(self):
- try:
- self._ssock.recv(1)
- except (BlockingIOError, InterruptedError):
- pass
+ while True:
+ try:
+ data = self._ssock.recv(4096)
+ if not data:
+ break
+ except InterruptedError:
+ continue
+ except BlockingIOError:
+ break
def _write_to_self(self):
# This may be called from a different thread, possibly after