Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1d59a0a

Browse files
committed
Merge 3.6
2 parents 65f86a4 + cb5fe9c commit 1d59a0a

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

Tools/gdb/libpython.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,11 @@ def get_selected_frame(cls):
15701570
def get_selected_python_frame(cls):
15711571
'''Try to obtain the Frame for the python-related code in the selected
15721572
frame, or None'''
1573-
frame = cls.get_selected_frame()
1573+
try:
1574+
frame = cls.get_selected_frame()
1575+
except gdb.error:
1576+
# No frame: Python didn't start yet
1577+
return None
15741578

15751579
while frame:
15761580
if frame.is_python_frame():
@@ -1711,6 +1715,10 @@ def invoke(self, args, from_tty):
17111715
def move_in_stack(move_up):
17121716
'''Move up or down the stack (for the py-up/py-down command)'''
17131717
frame = Frame.get_selected_python_frame()
1718+
if not frame:
1719+
print('Unable to locate python frame')
1720+
return
1721+
17141722
while frame:
17151723
if move_up:
17161724
iter_frame = frame.older()
@@ -1773,6 +1781,10 @@ def __init__(self):
17731781

17741782
def invoke(self, args, from_tty):
17751783
frame = Frame.get_selected_python_frame()
1784+
if not frame:
1785+
print('Unable to locate python frame')
1786+
return
1787+
17761788
while frame:
17771789
if frame.is_python_frame():
17781790
frame.print_summary()
@@ -1790,8 +1802,12 @@ def __init__(self):
17901802

17911803

17921804
def invoke(self, args, from_tty):
1793-
sys.stdout.write('Traceback (most recent call first):\n')
17941805
frame = Frame.get_selected_python_frame()
1806+
if not frame:
1807+
print('Unable to locate python frame')
1808+
return
1809+
1810+
sys.stdout.write('Traceback (most recent call first):\n')
17951811
while frame:
17961812
if frame.is_python_frame():
17971813
frame.print_traceback()

0 commit comments

Comments
 (0)