Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9699b3e

Browse files
authored
Prevent crash on StackData NotOneValueFound. (#14286)
This is a workaround for #13598, It does not fix the root cause, but should prevent IPython crash. Worst case it should just not show the relevant frame
2 parents d6abca8 + 9e43788 commit 9699b3e

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

IPython/core/ultratb.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,20 @@ def variables_in_executing_piece(self):
789789

790790
@property
791791
def lines(self):
792-
return self._sd.lines
792+
from executing.executing import NotOneValueFound
793+
794+
try:
795+
return self._sd.lines
796+
except NotOneValueFound:
797+
798+
class Dummy:
799+
lineno = 0
800+
is_current = False
801+
802+
def render(self, *, pygmented):
803+
return "<Error retrieving source code with stack_data see ipython/ipython#13598>"
804+
805+
return [Dummy()]
793806

794807
@property
795808
def executing(self):

0 commit comments

Comments
 (0)