| 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 |