bluebird75 / winpdb

Fork of the official winpdb with improvements
Other
91 stars 24 forks source link

Get wrong line (16) when setting a breakpoint at line 29 #43

Open jfongattw opened 1 year ago

jfongattw commented 1 year ago

It runs under Python 3.8 and Windows 8.1 x64. Although it's running a previous version here, but the same result in ver 2.0.0.1 too. The followings are the result of after adding print() in the function CalcScopeLine() to show what errors I had got:

def CalcScopeLine(self, lineno):
    print(lineno)
    rvl = copy.copy(self.m_valid_lines)  # m_valid_lines has strange result
    rvl.reverse()
    print(rvl)

    for l in rvl:  # JF@21DEC2022, this will cause a correct lineno (29) changes to an incorrect l (16)?
        if lineno >= l:
            break
    return l

-----the main window e:\Works\Python\ttkwidgets-master\examples>py ....\rpdb2.py example_calendar.py ....\rpdb2.py:296: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp RPDB2 - The Remote Python Debugger, version RPDB_2_5_0, Copyright (C) 2005-2009 Nir Aides, 2013-2017 Philippe Fremy Type "help", "copyright", "license", "credits" for more information.

Password has been set to a random password. Starting debuggee... Attaching to debuggee... Debug Channel is NOT encrypted. Successfully attached to 'e:\works\python\ttkwidgets-master\examples\example_calendar.py'. *** Debuggee is waiting at break point for further commands. bl List of breakpoints:

Id State Line Filename-Scope-Condition-Encoding

bp 29

bl List of breakpoints:

Id State Line Filename-Scope-Condition-Encoding

0 enabled 16 ...\examples\example_calendar.py

> list Source lines for thread 111776 from file 'e:\works\python\ttkwidgets-master\examples\example_calendar.py': 1 # -*- coding: utf-8 -*- 2 3 # Copyright (c) Juliette Monsel 2018 4 # For license see LICENSE 5 C> 6 from ttkwidgets import Calendar 7 import tkinter as tk 8 9 def validate(): 10 sel = calendar.selection 11 if sel is not None: 12 label.configure(text='Selected date: %s' % sel.st... 13 14 window = tk.Tk() 15 calendar = Calendar(window, year=2022, month=10, selectfo... B 16 selectbackground='red') 17 calendar.pack() 18 19 tk.Button(window, text='Select', command=validate).pack() 20 label = tk.Label(window, text='Selected date:') > ----- -----the other window e:\Works\Python\rpdb2.py:296: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp 6 [285, 284, 277, 276, 275, 273, 271, 16, 15, 14, 9, 7, 6] 29 [285, 284, 277, 276, 275, 273, 271, 16, 15, 14, 9, 7, 6] ----- The example_calendar.py file has only 30 lines long. What is the line 271 and aboves? and line 29 is missing obviously
jfongattw commented 1 year ago

Run it under Python 3.4 and this error is gone!!