MCPcopy Index your code
hub / github.com/python/cpython / poll_subprocess

Method poll_subprocess

Lib/idlelib/pyshell.py:577–613  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

575 active_seq = None
576
577 def poll_subprocess(self):
578 clt = self.rpcclt
579 if clt is None:
580 return
581 try:
582 response = clt.pollresponse(self.active_seq, wait=0.05)
583 except (EOFError, OSError, KeyboardInterrupt):
584 # lost connection or subprocess terminated itself, restart
585 # [the KBI is from rpc.SocketIO.handle_EOF()]
586 if self.tkconsole.closing:
587 return
588 response = None
589 self.restart_subprocess()
590 if response:
591 self.tkconsole.resetoutput()
592 self.active_seq = None
593 how, what = response
594 console = self.tkconsole.console
595 if how == "OK":
596 if what is not None:
597 print(repr(what), file=console)
598 elif how == "EXCEPTION":
599 if self.tkconsole.getvar("<<toggle-jit-stack-viewer>>"):
600 self.remote_stack_viewer()
601 elif how == "ERROR":
602 errmsg = "pyshell.ModifiedInterpreter: Subprocess ERROR:\n"
603 print(errmsg, what, file=sys.__stderr__)
604 print(errmsg, what, file=console)
605 # we received a response to the currently active seq number:
606 try:
607 self.tkconsole.endexecuting()
608 except AttributeError: # shell may have closed
609 pass
610 # Reschedule myself
611 if not self.tkconsole.closing:
612 self._afterid = self.tkconsole.text.after(
613 self.tkconsole.pollinterval, self.poll_subprocess)
614
615 debugger = None
616

Callers 1

start_subprocessMethod · 0.95

Calls 7

restart_subprocessMethod · 0.95
remote_stack_viewerMethod · 0.95
pollresponseMethod · 0.80
resetoutputMethod · 0.80
endexecutingMethod · 0.80
afterMethod · 0.80
getvarMethod · 0.45

Tested by

no test coverage detected