This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author aroberge
Recipients aroberge, terry.reedy
Date 2021-06-19.19:57:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1624132641.86.0.0653298089009.issue43476@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-06-19 19:57:21arobergesetrecipients: + aroberge, terry.reedy
2021-06-19 19:57:21arobergesetmessageid: <1624132641.86.0.0653298089009.issue43476@roundup.psfhosted.org>
2021-06-19 19:57:21arobergelinkissue43476 messages
2021-06-19 19:57:21arobergecreate