MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / runcode

Method runcode

tools/python-3.11.9-amd64/Lib/idlelib/run.py:573–604  ·  view source on GitHub ↗
(self, code)

Source from the content-addressed store, hash-verified

571 self.locals = {}
572
573 def runcode(self, code):
574 global interruptable
575 try:
576 self.user_exc_info = None
577 interruptable = True
578 try:
579 exec(code, self.locals)
580 finally:
581 interruptable = False
582 except SystemExit as e:
583 if e.args: # SystemExit called with an argument.
584 ob = e.args[0]
585 if not isinstance(ob, (type(None), int)):
586 print('SystemExit: ' + str(ob), file=sys.stderr)
587 # Return to the interactive prompt.
588 except:
589 self.user_exc_info = sys.exc_info() # For testing, hook, viewer.
590 if quitting:
591 exit()
592 if sys.excepthook is sys.__excepthook__:
593 print_exception()
594 else:
595 try:
596 sys.excepthook(*self.user_exc_info)
597 except:
598 self.user_exc_info = sys.exc_info() # For testing.
599 print_exception()
600 jit = self.rpchandler.console.getvar("<<toggle-jit-stack-viewer>>")
601 if jit:
602 self.rpchandler.interp.open_remote_stack_viewer()
603 else:
604 flush_stdout()
605
606 def interrupt_the_server(self):
607 if interruptable:

Callers 2

run_module_eventMethod · 0.45
test_exceptionsMethod · 0.45

Calls 8

strFunction · 0.85
exitFunction · 0.85
flush_stdoutFunction · 0.85
print_exceptionFunction · 0.70
typeClass · 0.50
printFunction · 0.50
getvarMethod · 0.45

Tested by 1

test_exceptionsMethod · 0.36