mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
[3.10] bpo-44446: support lineno being None in traceback.FrameSummary (GH-26781) (GH-27072)
As of088a15c49d
, lineno is None instead of -1 if there is no line number. Signed-off-by: Filipe Laíns <lains@riseup.net>. (cherry picked from commit91a8f8c16c
) Co-authored-by: Filipe Laíns <lains@riseup.net> Co-authored-by: Filipe Laíns <lains@riseup.net>
This commit is contained in:
parent
08697ac5d1
commit
61eb9b5dfd
3 changed files with 9 additions and 3 deletions
|
@ -301,9 +301,10 @@ class FrameSummary:
|
|||
@property
|
||||
def line(self):
|
||||
if self._line is None:
|
||||
self._line = linecache.getline(self.filename, self.lineno).strip()
|
||||
return self._line
|
||||
|
||||
if self.lineno is None:
|
||||
return None
|
||||
self._line = linecache.getline(self.filename, self.lineno)
|
||||
return self._line.strip()
|
||||
|
||||
def walk_stack(f):
|
||||
"""Walk a stack yielding the frame and line number for each frame.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue