mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
[3.9] bpo-28528: Fix pdb.checkline() attribute error when 'curframe' is None (GH-25438) (GH-26053)
Co-authored-by: Thomas Kluyver <takowl@gmail.com>
(cherry picked from commit 8563a7052c
)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
Automerge-Triggered-By: GH:iritkatriel
This commit is contained in:
parent
7d38b04b61
commit
6c190b5ae5
3 changed files with 42 additions and 1 deletions
|
@ -752,7 +752,8 @@ class Pdb(bdb.Bdb, cmd.Cmd):
|
|||
"""
|
||||
# this method should be callable before starting debugging, so default
|
||||
# to "no globals" if there is no current frame
|
||||
globs = self.curframe.f_globals if hasattr(self, 'curframe') else None
|
||||
frame = getattr(self, 'curframe', None)
|
||||
globs = frame.f_globals if frame else None
|
||||
line = linecache.getline(filename, lineno, globs)
|
||||
if not line:
|
||||
self.message('End of file')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue