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
14b2d30b
Commit
14b2d30b
authored
Feb 01, 1999
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect against accessing an empty stack.
parent
6aa42579
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
Tools/idle/StackViewer.py
Tools/idle/StackViewer.py
+11
-2
No files found.
Tools/idle/StackViewer.py
View file @
14b2d30b
...
...
@@ -100,6 +100,7 @@ class StackViewer(ScrolledList):
ScrolledList
.
__init__
(
self
,
master
)
self
.
flist
=
flist
self
.
browser
=
browser
self
.
stack
=
[]
def
load_stack
(
self
,
stack
,
index
=
None
):
self
.
stack
=
stack
...
...
@@ -132,6 +133,10 @@ class StackViewer(ScrolledList):
if
index
is
not
None
:
self
.
select
(
index
)
def
popup_event
(
self
,
event
):
if
self
.
stack
:
return
ScrolledList
.
popup_event
(
self
,
event
)
def
fill_menu
(
self
):
menu
=
self
.
menu
menu
.
add_command
(
label
=
"Go to source line"
,
...
...
@@ -140,6 +145,7 @@ class StackViewer(ScrolledList):
command
=
self
.
show_stack_frame
)
def
on_select
(
self
,
index
):
if
0
<=
index
<
len
(
self
.
stack
):
self
.
browser
.
show_frame
(
self
.
stack
[
index
])
def
on_double
(
self
,
index
):
...
...
@@ -151,9 +157,12 @@ class StackViewer(ScrolledList):
def
show_stack_frame
(
self
):
index
=
self
.
listbox
.
index
(
"active"
)
if
0
<=
index
<
len
(
self
.
stack
):
self
.
browser
.
show_frame
(
self
.
stack
[
index
])
def
show_source
(
self
,
index
):
if
not
(
0
<=
index
<
len
(
self
.
stack
)):
return
frame
,
lineno
=
self
.
stack
[
index
]
code
=
frame
.
f_code
filename
=
code
.
co_filename
...
...
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