Show More
@@ -621,3 +621,12 b' class Pdb(OldPdb, object):' | |||||
621 | self.print_stack_trace() |
|
621 | self.print_stack_trace() | |
622 |
|
622 | |||
623 | do_w = do_where |
|
623 | do_w = do_where | |
|
624 | ||||
|
625 | ||||
|
626 | def set_trace(frame=None): | |||
|
627 | """ | |||
|
628 | Start debugging from `frame`. | |||
|
629 | ||||
|
630 | If frame is not specified, debugging starts from caller's frame. | |||
|
631 | """ | |||
|
632 | Pdb().set_trace(frame or sys._getframe().f_back) |
@@ -7,6 +7,8 b' from prompt_toolkit.token import Token' | |||||
7 | from prompt_toolkit.shortcuts import create_prompt_application |
|
7 | from prompt_toolkit.shortcuts import create_prompt_application | |
8 | from prompt_toolkit.interface import CommandLineInterface |
|
8 | from prompt_toolkit.interface import CommandLineInterface | |
9 | from prompt_toolkit.enums import EditingMode |
|
9 | from prompt_toolkit.enums import EditingMode | |
|
10 | import sys | |||
|
11 | ||||
10 |
|
12 | |||
11 | class TerminalPdb(Pdb): |
|
13 | class TerminalPdb(Pdb): | |
12 | def __init__(self, *args, **kwargs): |
|
14 | def __init__(self, *args, **kwargs): | |
@@ -72,6 +74,12 b' class TerminalPdb(Pdb):' | |||||
72 | except Exception: |
|
74 | except Exception: | |
73 | raise |
|
75 | raise | |
74 |
|
76 | |||
75 | def set_trace(): |
|
77 | ||
76 | TerminalPdb().set_trace() |
|
78 | def set_trace(frame=None): | |
|
79 | """ | |||
|
80 | Start debugging from `frame`. | |||
|
81 | ||||
|
82 | If frame is not specified, debugging starts from caller's frame. | |||
|
83 | """ | |||
|
84 | TerminalPdb().set_trace(frame or sys._getframe().f_back) | |||
77 |
|
85 |
General Comments 0
You need to be logged in to leave comments.
Login now