|
10 | 10 | import repr |
11 | 11 |
|
12 | 12 |
|
| 13 | +# Interaction prompt line will separate file and call info from code |
| 14 | +# text using value of line_prefix string. A newline and arrow may |
| 15 | +# be to your liking. You can set it once pdb is imported using the |
| 16 | +# command "pdb.line_prefix = '\n% '". |
| 17 | +# line_prefix = ': ' # Use this to get the old situation back |
| 18 | +line_prefix = '\n-> ' # Probably a better default |
| 19 | + |
13 | 20 | class Pdb(bdb.Bdb, cmd.Cmd): |
14 | 21 |
|
15 | 22 | def __init__(self): |
@@ -55,7 +62,8 @@ def user_exception(self, frame, (exc_type, exc_value, exc_traceback)): |
55 | 62 |
|
56 | 63 | def interaction(self, frame, traceback): |
57 | 64 | self.setup(frame, traceback) |
58 | | - self.print_stack_entry(self.stack[self.curindex]) |
| 65 | + self.print_stack_entry(self.stack[self.curindex], |
| 66 | + line_prefix) |
59 | 67 | self.cmdloop() |
60 | 68 | self.forget() |
61 | 69 |
|
@@ -280,13 +288,13 @@ def print_stack_trace(self): |
280 | 288 | except KeyboardInterrupt: |
281 | 289 | pass |
282 | 290 |
|
283 | | - def print_stack_entry(self, frame_lineno): |
| 291 | + def print_stack_entry(self, frame_lineno, prompt_prefix=''): |
284 | 292 | frame, lineno = frame_lineno |
285 | 293 | if frame is self.curframe: |
286 | 294 | print '>', |
287 | 295 | else: |
288 | 296 | print ' ', |
289 | | - print self.format_stack_entry(frame_lineno) |
| 297 | + print self.format_stack_entry(frame_lineno, prompt_prefix) |
290 | 298 |
|
291 | 299 |
|
292 | 300 | # Help methods (derived from pdb.doc) |
|
0 commit comments