]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-34989: python-gdb.py: fix current_line_num() (GH-9889) (GH-9899)
authorVictor Stinner <vstinner@redhat.com>
Mon, 15 Oct 2018 22:06:23 +0000 (00:06 +0200)
committerGitHub <noreply@github.com>
Mon, 15 Oct 2018 22:06:23 +0000 (00:06 +0200)
commitaadb44ee98bc73bc5132acea5848ac6aef1ff8c0
treeaae1018851a530de323c04a994c5b232b94ee8ae
parent43308dfc3335906cfefe9f14a44e468935f3c321
bpo-34989: python-gdb.py: fix current_line_num() (GH-9889) (GH-9899)

python-gdb.py now handles errors on computing the line number
of a Python frame.

Changes:

* PyFrameObjectPtr.current_line_num() now catchs any Exception on
  calling addr2line(), instead of failing with a surprising "<class
  'TypeError'> 'FakeRepr' object is not subscriptable" error.
* All callers of current_line_num() now handle current_line_num()
  returning None.
* PyFrameObjectPtr.current_line() now also catchs IndexError on
  getting a line from the Python source file.

(cherry picked from commit 2e438cc2554495b28480a3ffe5cdf41b6ab823a0)
Misc/NEWS.d/next/Tools-Demos/2018-10-15-13-22-28.bpo-34989.hU4fra.rst [new file with mode: 0644]
Tools/gdb/libpython.py