I just installed 3.11.0 and love the new feature PEP 657 – Include Fine Grained Error Locations in Tracebacks! But it seems that it doesn’t work IDLE nor the shell REPL:
$ python3.11
Python 3.11.0 (main, Oct 26 2022, 11:33:21) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> x = {'a': {'b': None}}
>>> x['a']['b']['c']['d'] = 1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not subscriptable
Compare to use in a file, as in the example:
$ cat test.py
x = {'a': {'b': None}}
x['a']['b']['c']['d'] = 1
print(x['a']['b']['c']['d'])
$ python3.11 test.py
Traceback (most recent call last):
File "/data/shared/lusers/enneking/test.py", line 4 in <module>
x['a']['b']['c']['d'] = 1
~~~~~~~~~~~^^^^^
TypeError: 'NoneType' object is not subscriptable
Can it be added to IDLE and the shell REPL?
(NB: The REPL is not discussed in the PEP nor the main discourse thread for PEP 657 (now closed).)