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

Method runcode

Lib/code.py:78–95  ·  view source on GitHub ↗

Execute a code object. When an exception occurs, self.showtraceback() is called to display a traceback. All exceptions are caught except SystemExit, which is reraised. A note about KeyboardInterrupt: this exception may occur elsewhere in this code, and may

(self, code)

Source from the content-addressed store, hash-verified

76 return False
77
78 def runcode(self, code):
79 """Execute a code object.
80
81 When an exception occurs, self.showtraceback() is called to
82 display a traceback. All exceptions are caught except
83 SystemExit, which is reraised.
84
85 A note about KeyboardInterrupt: this exception may occur
86 elsewhere in this code, and may not always be caught. The
87 caller should be prepared to deal with it.
88
89 """
90 try:
91 exec(code, self.locals)
92 except SystemExit:
93 raise
94 except:
95 self.showtraceback()
96
97 def showsyntaxerror(self, filename=None, **kwargs):
98 """Display the syntax error that just occurred.

Callers 1

runsourceMethod · 0.95

Calls 1

showtracebackMethod · 0.95

Tested by

no test coverage detected