| 2942 | return compfunc(text, line, begidx, endidx) |
| 2943 | |
| 2944 | def cmdloop(self, intro=None): |
| 2945 | self.preloop() |
| 2946 | if intro is not None: |
| 2947 | self.intro = intro |
| 2948 | if self.intro: |
| 2949 | self.message(str(self.intro)) |
| 2950 | stop = None |
| 2951 | while not stop: |
| 2952 | if self._interact_state is not None: |
| 2953 | try: |
| 2954 | reply = self._get_input(prompt=">>> ", state="interact") |
| 2955 | except KeyboardInterrupt: |
| 2956 | # Match how KeyboardInterrupt is handled in a REPL |
| 2957 | self.message("\nKeyboardInterrupt") |
| 2958 | except EOFError: |
| 2959 | self.message("\n*exit from pdb interact command*") |
| 2960 | self._interact_state = None |
| 2961 | else: |
| 2962 | self._run_in_python_repl(reply) |
| 2963 | continue |
| 2964 | |
| 2965 | if not self.cmdqueue: |
| 2966 | try: |
| 2967 | state = "commands" if self.commands_defining else "pdb" |
| 2968 | reply = self._get_input(prompt=self.prompt, state=state) |
| 2969 | except EOFError: |
| 2970 | reply = "EOF" |
| 2971 | |
| 2972 | self.cmdqueue.append(reply) |
| 2973 | |
| 2974 | line = self.cmdqueue.pop(0) |
| 2975 | line = self.precmd(line) |
| 2976 | stop = self.onecmd(line) |
| 2977 | stop = self.postcmd(stop, line) |
| 2978 | self.postloop() |
| 2979 | |
| 2980 | def postloop(self): |
| 2981 | super().postloop() |