[issue24252] IDLE removes elements from tracebacks.

Terry J. Reedy report at bugs.python.org
Thu May 21 09:02:56 CEST 2015


Terry J. Reedy added the comment:

The two additional entries are the last two.  In this case, they are needed because KeyError pertains to the dict lookup in the last line "self.breaks[filename]".

Mistaken in this particular case or not, the deletion is intentional. Run.print_exception has these two lines:
    exclude = ("run.py", "rpc.py", "threading.py", "Queue.py",
               "RemoteDebugger.py", "bdb.py")
    cleanup_traceback(tbe, exclude)
The docstring for cleanup_traceback is "Remove excluded traces from beginning/end of tb; get cached lines".

The intent of the first 4 excludes is to make the tracebacks displayed in Idle for normal (non-debug) code the same as with Python, without Idle.  The intent of the last 2 is to continue the equivalence when using the Idle debugger (which inherits from bdb.py).

Using pdb with Idle is known to be somewhat problematical because Idle revises the execution environment.  In particular, identical tracebacks cannot be guaranteed.  (I tried to find the issue bug the buggy tracker search did not return the issue.)

A fix for this particular example would be to omit/remove bdb from exclude (which could be a set) when the first item contains 'pdb'.  I would consider a patch to do that.

----------
stage:  -> needs patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24252>
_______________________________________


More information about the Python-bugs-list mailing list