FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-140790: pdb: Initialize instance variables in Pdb.__init__ by Carreau · Pull Request #140791 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
10 changes: 8 additions & 2 deletions Lib/pdb.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@ def __init__(self, completekey='tab', stdin=None, stdout=None, skip=None,

self._current_task = None

self.lineno = None
self.stack = []
self.curindex = 0
self.curframe = None
self._user_requested_quit = False

def set_trace(self, frame=None, *, commands=None):
Pdb._last_pdb_instance = self
if frame is None:
Expand Down Expand Up @@ -474,7 +480,7 @@ def forget(self):
self.lineno = None
self.stack = []
self.curindex = 0
if hasattr(self, 'curframe') and self.curframe:
if self.curframe:
self.curframe.f_globals.pop('__pdb_convenience_variables', None)
self.curframe = None
self.tb_lineno.clear()
Expand Down Expand Up @@ -1493,7 +1499,7 @@ def checkline(self, filename, lineno, module_globals=None):
"""
# this method should be callable before starting debugging, so default
# to "no globals" if there is no current frame
frame = getattr(self, 'curframe', None)
frame = self.curframe
if module_globals is None:
module_globals = frame.f_globals if frame else None
line = linecache.getline(filename, lineno, module_globals)
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Initialize all Pdb's instance variables in ``__init__``, remove some hasattr/getattr
Loading

Back | FazBrowse Home | New Git URL