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

Method interaction

Lib/pdb.py:746–773  ·  view source on GitHub ↗
(self, frame, tb_or_exc)

Source from the content-addressed store, hash-verified

744 return task
745
746 def interaction(self, frame, tb_or_exc):
747 # Restore the previous signal handler at the Pdb prompt.
748 if Pdb._previous_sigint_handler:
749 try:
750 signal.signal(signal.SIGINT, Pdb._previous_sigint_handler)
751 except ValueError: # ValueError: signal only works in main thread
752 pass
753 else:
754 Pdb._previous_sigint_handler = None
755
756 self._current_task = self._get_asyncio_task()
757
758 _chained_exceptions, tb = self._get_tb_and_exceptions(tb_or_exc)
759 if isinstance(tb_or_exc, BaseException):
760 assert tb is not None, "main exception must have a traceback"
761 with self._hold_exceptions(_chained_exceptions):
762 self.setup(frame, tb)
763 # We should print the stack entry if and only if the user input
764 # is expected, and we should print it right before the user input.
765 # We achieve this by appending _pdbcmd_print_frame_status to the
766 # command queue. If cmdqueue is not exhausted, the user input is
767 # not expected and we will not print the stack entry.
768 self.cmdqueue.append('_pdbcmd_print_frame_status')
769 self._cmdloop()
770 # If _pdbcmd_print_frame_status is not used, pop it out
771 if self.cmdqueue and self.cmdqueue[-1] == '_pdbcmd_print_frame_status':
772 self.cmdqueue.pop()
773 self.forget()
774
775 def displayhook(self, obj):
776 """Custom displayhook for the exec in default(), which prevents

Callers 7

debug_scriptFunction · 0.95
user_callMethod · 0.95
user_lineMethod · 0.95
user_returnMethod · 0.95
user_exceptionMethod · 0.95
mainFunction · 0.95
_post_mortemFunction · 0.45

Calls 8

_get_asyncio_taskMethod · 0.95
_hold_exceptionsMethod · 0.95
setupMethod · 0.95
_cmdloopMethod · 0.95
forgetMethod · 0.95
appendMethod · 0.45
popMethod · 0.45

Tested by 1

debug_scriptFunction · 0.76