Terry J. Reedy added the comment: Code entered with -c seems to be treated the same as code entered at the >>> prompt of the interactive interpreter.
>>> 1/0 Traceback (most recent call last): File "<stdin>", line 1, in <module> ZeroDivisionError: division by zero In both cases, the offending code is right there to be seen, so I can understand reluctance to echo it. For SyntaxErrors (and only them) echoing the code is needed to have something to point to. Idle's Shell does what you want. >>> 1/0 Traceback (most recent call last): File "<pyshell#12>", line 1, in <module> 1/0 ZeroDivisionError: division by zero Shell can do this because it has easy, platform-independent access to the tkinter Text widget storing and displaying previously entered code. I presume accessing a system-dependent console history buffer is much harder. Where the difference really matters is when the error is in previously defined objects. >>> def f(): ... return a >>> f() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 2, in f NameError: name 'a' is not defined versus (Shell) >>> def f(): return a >>> f() Traceback (most recent call last): File "<pyshell#16>", line 1, in <module> f() File "<pyshell#15>", line 2, in f return a NameError: name 'a' is not defined ---------- nosy: +terry.reedy _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23035> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com