mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
[3.11] gh-89419: gdb: fix bug causing AttributeError in py-locals when no frame is available (GH-100611) (#100738)
gh-89419: gdb: fix bug causing AttributeError in py-locals when no frame is available (GH-100611) ``` Unable to read information on python frame Python Exception <class 'AttributeError'>: 'NoneType' object has no attribute 'co_name' ``` Regression in commitb4903afd4d
. While refactoring the code into a while loop, the previous early return when no frame exists went missing. We have just printed a message that we cannot get information about this, so the frame will be None, and we cannot attempt to use it. Discovered on python 3.11, in python 3.12a2 this should error out with `.is_shim()` instead of `co_name`. (cherry picked from commit8586949833
)
This commit is contained in:
parent
b93bd153d5
commit
d8073ee6f3
2 changed files with 2 additions and 0 deletions
|
@ -0,0 +1 @@
|
|||
Fix a bug that caused an :exc:`AttributeError` to be raised in ``python-gdb.py`` when ``py-locals`` is used without a frame.
|
|
@ -2126,6 +2126,7 @@ class PyLocals(gdb.Command):
|
|||
while True:
|
||||
if not pyop_frame:
|
||||
print(UNABLE_READ_INFO_PYTHON_FRAME)
|
||||
break
|
||||
|
||||
sys.stdout.write('Locals for %s\n' % (pyop_frame.co_name.proxyval(set())))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue