From 9699b3e6e292f90b1e924b8d0938813afc2e0dd1 2024-01-09 09:20:48 From: M Bussonnier Date: 2024-01-09 09:20:48 Subject: [PATCH] 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 --- diff --git a/IPython/core/ultratb.py b/IPython/core/ultratb.py index 27d92dc..0e4a097 100644 --- a/IPython/core/ultratb.py +++ b/IPython/core/ultratb.py @@ -789,7 +789,20 @@ class FrameInfo: @property def lines(self): - return self._sd.lines + from executing.executing import NotOneValueFound + + try: + return self._sd.lines + except NotOneValueFound: + + class Dummy: + lineno = 0 + is_current = False + + def render(self, *, pygmented): + return "" + + return [Dummy()] @property def executing(self):