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 single steps list comprehensions
Type: Stage:
Components: Demos and Tools Versions: Python 2.2
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: skip.montanaro Nosy List: nnorwitz, skip.montanaro, tree
Priority: normal Keywords:

Created on 2002-02-28 18:59 by tree, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (3)
msg9462 - (view) Author: Tom Emerson (tree) Date: 2002-02-28 18:59
Within PDB you cannot 'n'ext over a list comprehension:
instead you step through each iteration. In some cases
this is quite painful, since the comprehension may have
several hundred elements.

For example,

def doit():
    foo = [ 2 * x for x in range(100) ]
    print foo

requires you to either step through all 100 iterations
of the comprehension, or set a temporary breakpoint on
the line after the comprehension.

My expectation would be that 'n'ext would execute the
comprehension and move on to the next line.

If this isn't a bug, and is working by design, then I'd
like to suggest a command that allows you to fully
execute comprehensions.

I've seen this with versions 2.0 -- 2.2 on several
platforms.
msg9463 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-09-06 23:03
Logged In: YES 
user_id=33168

Skip did you fix this a while back?  Or do you know if
Michael fixed this with the SET_LINENO changes?
msg9464 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2002-09-07 02:37
Logged In: YES 
user_id=44345

Yes, thanks for reporting it, but it is fixed in CVS.  Note no breaks after 
executing 'n'.

>>> import doit
>>> import pdb
>>> pdb.run("doit.doit()")
> <string>(1)?()
(Pdb) n
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 
40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 
76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 
110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 
138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 
166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 
194, 196, 198]
History
Date User Action Args
2022-04-10 16:05:03adminsetgithub: 36182
2002-02-28 18:59:19treecreate