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

Method cancel_callback

Lib/idlelib/pyshell.py:1198–1218  ·  view source on GitHub ↗
(self, event=None)

Source from the content-addressed store, hash-verified

1196 return True
1197
1198 def cancel_callback(self, event=None):
1199 try:
1200 if self.text.compare("sel.first", "!=", "sel.last"):
1201 return # Active selection -- always use default binding
1202 except:
1203 pass
1204 if not (self.executing or self.reading):
1205 self.resetoutput()
1206 self.interp.write("KeyboardInterrupt\n")
1207 self.showprompt()
1208 return "break"
1209 self.endoffile = False
1210 self.canceled = True
1211 if (self.executing and self.interp.rpcclt):
1212 if self.interp.getdebugger():
1213 self.interp.restart_subprocess()
1214 else:
1215 self.interp.interrupt_subprocess()
1216 if self.reading:
1217 self.top.quit() # exit the nested mainloop() in readline()
1218 return "break"
1219
1220 def eof_callback(self, event):
1221 if self.executing and not self.reading:

Callers

nothing calls this directly

Calls 8

resetoutputMethod · 0.95
showpromptMethod · 0.95
getdebuggerMethod · 0.80
restart_subprocessMethod · 0.80
interrupt_subprocessMethod · 0.80
compareMethod · 0.45
writeMethod · 0.45
quitMethod · 0.45

Tested by

no test coverage detected