On Tue, Apr 20, 2021 at 6:50 PM Chris Angelico firstname.lastname@example.org wrote:
On Wed, Apr 21, 2021 at 7:46 AM Rob Cliffe via Python-ideas email@example.com wrote:
On 20/04/2021 19:23, Pol Welter wrote:
Would it be reasonable to include the line number for the function
`foo()` that it resolved the call to? I.e. 'File "<stdin>", line 1, in foo'.
And presumably the module name as well. If foo had been imported from a different module instead of defined in the current one, the line number alone would be less helpful.
Maybe the easiest/best way would be to have a reference to the function itself available on the exception object?
I personally think that the easiest/best way would be for Python to use something like "<stdin-N>" as a "file" name in its repl and in exec, and use linecache to store each file. This way, the file content (and line number, etc.) could be retrieved and included in the traceback. This is often done in other REPLs (such as IPython and IDLE's pyshell).
Python-ideas mailing list -- firstname.lastname@example.org To unsubscribe send an email to email@example.com https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://firstname.lastname@example.org/message/XU72HF... Code of Conduct: http://python.org/psf/codeofconduct/