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

Method default

Lib/pdb.py:960–986  ·  view source on GitHub ↗
(self, line)

Source from the content-addressed store, hash-verified

958 return code, buffer, is_await_code
959
960 def default(self, line):
961 if line[:1] == '!': line = line[1:].strip()
962 locals = self.curframe.f_locals
963 globals = self.curframe.f_globals
964 try:
965 code, buffer, is_await_code = self._read_code(line)
966 if buffer is None:
967 return
968 save_stdout = sys.stdout
969 save_stdin = sys.stdin
970 save_displayhook = sys.displayhook
971 try:
972 sys.stdin = self.stdin
973 sys.stdout = self.stdout
974 sys.displayhook = self.displayhook
975 if is_await_code:
976 self._exec_await(buffer, globals, locals)
977 return True
978 else:
979 if not self._exec_in_closure(buffer, globals, locals):
980 exec(code, globals, locals)
981 finally:
982 sys.stdout = save_stdout
983 sys.stdin = save_stdin
984 sys.displayhook = save_displayhook
985 except:
986 self._error_exc()
987
988 def _replace_convenience_variables(self, line):
989 """Replace the convenience variables in 'line' with their values.

Callers 1

defaultMethod · 0.45

Calls 5

_read_codeMethod · 0.95
_exec_awaitMethod · 0.95
_exec_in_closureMethod · 0.95
_error_excMethod · 0.95
stripMethod · 0.45

Tested by

no test coverage detected