Message396152
Would it be possible to add a single line of code to idlelib's pyshell.py, as indicated below:
def showsyntaxerror(self, filename=None):
"""... """
linecache.cache["<SyntaxError>"] = linecache.cache[filename] # here
tkconsole = self.tkconsole
...
Of course, another name than "<SyntaxError>" could be chosen.
This would allow users (like me, with Friendly) to retrieve the code that caused a SyntaxError and process it as they wish. In my case, it would allow me to reproduce the SyntaxError and have Friendly provide an explanation and possible suggestions for fixing the error.
This would complement the new support for user defined sys.excepthook introduced in Python 3.10. |
|
Date |
User |
Action |
Args |
2021-06-19 19:57:21 | aroberge | set | recipients:
+ aroberge, terry.reedy |
2021-06-19 19:57:21 | aroberge | set | messageid: <1624132641.86.0.0653298089009.issue43476@roundup.psfhosted.org> |
2021-06-19 19:57:21 | aroberge | link | issue43476 messages |
2021-06-19 19:57:21 | aroberge | create | |
|