[ python-Bugs-1750076 ] Python 2.5+ skips while statements in debuggers

SourceForge.net noreply at sourceforge.net
Mon Jul 9 01:37:44 CEST 2007


Bugs item #1750076, was opened at 2007-07-08 18:24
Message generated for change (Comment added) made by gotgenes
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1750076&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Chris Lasher (gotgenes)
Assigned to: Nobody/Anonymous (nobody)
Summary: Python 2.5+ skips while statements in debuggers

Initial Comment:
Starting with Python 2.5, debuggers pass through a "while" statement on its declaration, but never return to it during the remainder of the loop. They should be able to return to the "while" statement as it has an evaluative step in it. This has several important implications: one may not check the state of variables at prior to their evaluation in the "while" statement, and any breakpoints set on the "while" statement are ignored once within the while loop.

Python prior versions (2.4 and below) exhibit expected behavior in that the "while" statement is returned to after each successful iteration through the loop, and breakpoints on "while" statements are honored.

----------------------------------------------------------------------

>Comment By: Chris Lasher (gotgenes)
Date: 2007-07-08 18:37

Message:
Logged In: YES 
user_id=1180453
Originator: YES

Notice how in Python 2.4, the breakpoint is honored through each iteration
through the while loop.

--

chris at feathers:~/development/playground$ python2.4 -m pdb simple.py 
> /home/chris/development/playground/simple.py(3)?()
-> a = 10
(Pdb) b 5
Breakpoint 1 at /home/chris/development/playground/simple.py:5
(Pdb) l
  1     #!/usr/bin/env python
  2  
  3  -> a = 10
  4  
  5 B   while a > 0:
  6         a -= 1      # how do I check the value of a at end of last
iter.?
  7  
  8     print "Fin!"
[EOF]
(Pdb) r
> /home/chris/development/playground/simple.py(5)?()
-> while a > 0:
(Pdb) p a
10
(Pdb) r
> /home/chris/development/playground/simple.py(5)?()
-> while a > 0:
(Pdb) p a
9
(Pdb) r
> /home/chris/development/playground/simple.py(5)?()
-> while a > 0:
(Pdb) p a
8
(Pdb) 


----------------------------------------------------------------------

Comment By: Chris Lasher (gotgenes)
Date: 2007-07-08 18:35

Message:
Logged In: YES 
user_id=1180453
Originator: YES

Notice how in Python 2.5, the breakpoint is met once then passed over,
leading straight to the final print statement

--

chris at feathers:~/development/playground$ python2.5 -m pdb simple.py 
> /home/chris/development/playground/simple.py(3)<module>()
-> a = 10
(Pdb) b 5
Breakpoint 1 at /home/chris/development/playground/simple.py:5
(Pdb) l
  1     #!/usr/bin/env python
  2  
  3  -> a = 10
  4  
  5 B   while a > 0:
  6         a -= 1      # how do I check the value of a at end of last
iter.?
  7  
  8     print "Fin!"
[EOF]
(Pdb) r
> /home/chris/development/playground/simple.py(5)<module>()
-> while a > 0:
(Pdb) r
Fin!
--Return--
> /home/chris/development/playground/simple.py(8)<module>()->None
-> print "Fin!"
(Pdb) 


----------------------------------------------------------------------

Comment By: Chris Lasher (gotgenes)
Date: 2007-07-08 18:32

Message:
Logged In: YES 
user_id=1180453
Originator: YES

Here's a file for demonstration purposes.
File Added: simple.py

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1750076&group_id=5470


More information about the Python-bugs-list mailing list