This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Pdb does not stop at a breakpoint after a restart command and source changes
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, wipolun, xdegaye
Priority: normal Keywords:

Created on 2012-05-25 11:35 by xdegaye, last changed 2022-04-11 14:57 by admin.

Messages (4)
msg161567 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2012-05-25 11:35
In the following session, main.py is changed just before the restart
command. Pdb does not stop at Breakpoint 1 after the last continue.

$ python -m pdb main.py
> /path_to/main.py(1)<module>()
-> def foo():
(Pdb) import sys; print(sys.version)
3.2.2 (default, Dec 27 2011, 17:35:55) 
[GCC 4.3.2]
(Pdb) break foo
Breakpoint 1 at /path_to/main.py:1
(Pdb) list
  1 B-> def foo():
  2         x = 1
  3         x = 2
  4
  5     foo()
[EOF]
(Pdb) continue
> /path_to/main.py(2)foo()
-> x = 1
(Pdb) restart
Restarting main.py with arguments:
        main.py
> /path_to/main.py(1)<module>()
-> def bar():
(Pdb) list
  1 B-> def bar():
  2         x = 1
  3         x = 2
  4
  5     def foo():
  6         bar()
  7
  8     foo()
[EOF]
(Pdb) continue
The program finished and will be restarted
> /path_to/main.py(1)<module>()
-> def bar():
(Pdb)
msg161575 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2012-05-25 11:57
Parsing the modules source seems a better way to fix this problem, see issue 14913.
msg176272 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2012-11-24 10:43
See also how this is fixed at
http://code.google.com/p/pdb-clone/source/detail?r=6ad576592286a005694690906644cb3004090eeb
msg304611 - (view) Author: Wipolun (wipolun) Date: 2017-10-19 09:34
Worked for me on https://www.cheshiremouldings.co.uk/stair-parts/
History
Date User Action Args
2022-04-11 14:57:30adminsetgithub: 59117
2017-10-19 09:34:19wipolunsetnosy: + wipolun
messages: + msg304611
2012-12-05 11:08:45asvetlovsetnosy: + asvetlov
2012-11-24 10:43:18xdegayesetmessages: + msg176272
2012-05-25 11:57:19xdegayesetmessages: + msg161575
2012-05-25 11:35:56xdegayecreate