diff --git a/Misc/NEWS.d/next/Tools-Demos/2022-12-29-19-22-11.bpo-45256.a0ee_H.rst b/Misc/NEWS.d/next/Tools-Demos/2022-12-29-19-22-11.bpo-45256.a0ee_H.rst new file mode 100644 index 00000000000000..9c1aa57625834e --- /dev/null +++ b/Misc/NEWS.d/next/Tools-Demos/2022-12-29-19-22-11.bpo-45256.a0ee_H.rst @@ -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. diff --git a/Tools/gdb/libpython.py b/Tools/gdb/libpython.py index 857e52f00a06eb..a99ce945265f67 100755 --- a/Tools/gdb/libpython.py +++ b/Tools/gdb/libpython.py @@ -2126,6 +2126,7 @@ def invoke(self, args, from_tty): 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())))