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

Method restart_subprocess

Lib/idlelib/pyshell.py:485–526  ·  view source on GitHub ↗
(self, with_cwd=False, filename='')

Source from the content-addressed store, hash-verified

483 return self.rpcclt
484
485 def restart_subprocess(self, with_cwd=False, filename=''):
486 if self.restarting:
487 return self.rpcclt
488 self.restarting = True
489 # close only the subprocess debugger
490 debug = self.getdebugger()
491 if debug:
492 try:
493 # Only close subprocess debugger, don't unregister gui_adap!
494 debugger_r.close_subprocess_debugger(self.rpcclt)
495 except:
496 pass
497 # Kill subprocess, spawn a new one, accept connection.
498 self.rpcclt.close()
499 self.terminate_subprocess()
500 console = self.tkconsole
501 console.executing = False
502 self.spawn_subprocess()
503 try:
504 self.rpcclt.accept()
505 except TimeoutError:
506 self.display_no_subprocess_error()
507 return None
508 self.transfer_path(with_cwd=with_cwd)
509 console.stop_readline()
510 # annotate restart in shell window and mark it
511 console.text.delete("iomark", "end-1c")
512 console.write('\n')
513 console.write(restart_line(console.width, filename))
514 console.text.mark_set("restart", "end-1c")
515 console.text.mark_gravity("restart", "left")
516 if not filename:
517 console.showprompt()
518 # restart subprocess debugger
519 if debug:
520 # Restarted debugger connects to current instance of debug GUI
521 debugger_r.restart_subprocess_debugger(self.rpcclt)
522 # reload remote debugger breakpoints for all PyShellEditWindows
523 debug.load_breakpoints()
524 self.compile.compiler.flags = self.original_compiler_flags
525 self.restarting = False
526 return self.rpcclt
527
528 def __request_interrupt(self):
529 self.rpcclt.remotecall("exec", "interrupt_the_server", (), {})

Callers 5

poll_subprocessMethod · 0.95
runcodeMethod · 0.95
cancel_callbackMethod · 0.80
restart_shellMethod · 0.80
run_module_eventMethod · 0.80

Calls 15

getdebuggerMethod · 0.95
terminate_subprocessMethod · 0.95
spawn_subprocessMethod · 0.95
transfer_pathMethod · 0.95
restart_lineFunction · 0.85
stop_readlineMethod · 0.80
mark_gravityMethod · 0.80
showpromptMethod · 0.80
load_breakpointsMethod · 0.80
closeMethod · 0.45
acceptMethod · 0.45

Tested by

no test coverage detected