rv = frame.f_locals['__return__']
s += '->'
s += reprlib.repr(rv)
- line = linecache.getline(filename, lineno, frame.f_globals)
- if line:
- s += lprefix + line.strip()
+ if lineno is not None:
+ line = linecache.getline(filename, lineno, frame.f_globals)
+ if line:
+ s += lprefix + line.strip()
return s
# The following methods can be called by clients to use
tracer.runcall(tfunc_import)
+class TestRegressions(unittest.TestCase):
+ def test_format_stack_entry_no_lineno(self):
+ # See gh-101517
+ Bdb().format_stack_entry((sys._getframe(), None))
+
+
if __name__ == "__main__":
unittest.main()