Making breakpoints functional in IDLE on Windows

Edward K. Ream edream at tds.net
Mon Feb 25 22:18:59 CET 2002


Hello all,

This morning Guido confirmed that breakpoints do not, in fact, work in
IDLE on any Windows machine(!)  The problem has to do with the case of
file names.

Here is how make breakpoints functional in IDLE.  The fix required 2
additional lines of code.  Both lines are marked with # EKR.

Insert 1 line in Python\Tools\idle\Debugger.py.  Change:

def set_break(self, filename, lineno, temporary=0, cond = None):
    import linecache # Import as late as possible
    line = linecache.getline(filename, lineno)
    ...

to:

def set_break(self, filename, lineno, temporary=0, cond = None):
    import linecache # Import as late as possible
    filename = self.canonic(filename) # EKR
    line = linecache.getline(filename, lineno)
    ...
    
Insert 1 line in Python\Lib\bdb.py.  Change:

def canonic(self, filename):
        canonic = self.fncache.get(filename)
        if not canonic:
            canonic = os.path.abspath(filename)
            self.fncache[filename] = canonic
        return canonic
To:

def canonic(self, filename):
        canonic = self.fncache.get(filename)
        if not canonic:
            canonic = os.path.abspath(filename)
            canonic = os.path.normcase(canonic) # EKR
            self.fncache[filename] = canonic
        return canonic

This works for me on Windows XP and Python 2.1.  I'll let you know if
any
problems come up.

Edward
--------------------------------------------------------------------
Edward K. Ream   email:  edream at tds.net
Leo: Literate Editor with Outlines
Leo: http://personalpages.tds.net/~edream/front.html
--------------------------------------------------------------------



More information about the Python-list mailing list