Closed aroberge closed 2 years ago
Doing some diagnostics, in friendly_traceback/core.py
, near line 272:
node_info = self.records[-1].node_info # noqa
print(f"{node_info=}")
if node_info:
self.node, _ignore, self.node_text = node_info
print(f"{self.node=}, {_ignore=}, {self.node_text=}")
Using simply friendly/friendly_traceback we get
node_info=(<ast.Subscript object at 0x000001E3FCA68460>, (0, 4), 'a[3]')
self.node=<ast.Subscript object at 0x000001E3FCA68460>, _ignore=(0, 4), self.node_text='a[3]'
However, when using within IPython, we get
node_info=(None, (0, 4), 'a[3]')
self.node=None, _ignore=(0, 4), self.node_text='a[3]'
One more example. When running simply IPython with the following example:
In [1]: a = [1, 2, 3]
In [2]: a[0] + a[3]
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 a[0] + a[3]
There is no highlighting of a[3]
.
Time for some screen captures.
This now appears to be fixed.
When running this example using simply friendly, we have:
When running from withing IPython, we get
<class 'NoneType'>
instead.