Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a558e37e
Commit
a558e37e
authored
Nov 10, 1994
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved prompt format
parent
e23b62f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
Lib/bdb.py
Lib/bdb.py
+2
-2
Lib/pdb.py
Lib/pdb.py
+11
-3
No files found.
Lib/bdb.py
View file @
a558e37e
...
...
@@ -242,7 +242,7 @@ class Bdb: # Basic Debugger
#
def
format_stack_entry
(
self
,
frame_lineno
):
def
format_stack_entry
(
self
,
frame_lineno
,
lprefix
=
': '
):
import
linecache
,
repr
,
string
frame
,
lineno
=
frame_lineno
filename
=
frame
.
f_code
.
co_filename
...
...
@@ -260,7 +260,7 @@ class Bdb: # Basic Debugger
s
=
s
+
'->'
s
=
s
+
repr
.
repr
(
rv
)
line
=
linecache
.
getline
(
filename
,
lineno
)
if
line
:
s
=
s
+
': '
+
string
.
strip
(
line
)
if
line
:
s
=
s
+
lprefix
+
string
.
strip
(
line
)
return
s
# The following two methods can be called by clients to use
...
...
Lib/pdb.py
View file @
a558e37e
...
...
@@ -10,6 +10,13 @@ import bdb
import
repr
# Interaction prompt line will separate file and call info from code
# text using value of line_prefix string. A newline and arrow may
# be to your liking. You can set it once pdb is imported using the
# command "pdb.line_prefix = '\n% '".
# line_prefix = ': ' # Use this to get the old situation back
line_prefix
=
'
\
n
-> '
# Probably a better default
class
Pdb
(
bdb
.
Bdb
,
cmd
.
Cmd
):
def
__init__
(
self
):
...
...
@@ -55,7 +62,8 @@ class Pdb(bdb.Bdb, cmd.Cmd):
def
interaction
(
self
,
frame
,
traceback
):
self
.
setup
(
frame
,
traceback
)
self
.
print_stack_entry
(
self
.
stack
[
self
.
curindex
])
self
.
print_stack_entry
(
self
.
stack
[
self
.
curindex
],
line_prefix
)
self
.
cmdloop
()
self
.
forget
()
...
...
@@ -280,13 +288,13 @@ class Pdb(bdb.Bdb, cmd.Cmd):
except
KeyboardInterrupt
:
pass
def
print_stack_entry
(
self
,
frame_lineno
):
def
print_stack_entry
(
self
,
frame_lineno
,
prompt_prefix
=
''
):
frame
,
lineno
=
frame_lineno
if
frame
is
self
.
curframe
:
print
'>'
,
else
:
print
' '
,
print
self
.
format_stack_entry
(
frame_lineno
)
print
self
.
format_stack_entry
(
frame_lineno
,
prompt_prefix
)
# Help methods (derived from pdb.doc)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment