Andre Roberge <andre.robe...@gmail.com> added the comment:

I just thought of making a copy of the file content under a known name as the 
least disruptive approach for IDLE's code - even less so than the recent 
addition required to support user-defined exception hooks.

For SyntaxErrors and subclasses [1], Friendly needs the source code as well as 
the error message, offset, lineno (end_offset and end_lineno if they are 
present) in order to perform its analysis. In all cases (i.e not only with IDLE 
but with other environments like Jupyter notebooks), it retrieves this source 
code from the given filename using the linecache module.  

If it were possible to get those exception arguments using RPC, this would be 
much better than what I suggested. This might also be much more useful that 
what I suggest for any third-party code wanting access to the traceback 
information for SyntaxErrors. However, I could not find a simple way of doing 
this.

[1] The required information for run-time errors, such as NameError, etc., is 
already available with sys.excepthook.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43476>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to