Message396166
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. |
|
Date |
User |
Action |
Args |
2021-06-20 09:36:04 | aroberge | set | recipients:
+ aroberge, terry.reedy |
2021-06-20 09:36:04 | aroberge | set | messageid: <1624181764.65.0.240215319399.issue43476@roundup.psfhosted.org> |
2021-06-20 09:36:04 | aroberge | link | issue43476 messages |
2021-06-20 09:36:04 | aroberge | create | |
|