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] NameError in list comprehension in PDB
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: castix, xdegaye, xtreak
Priority: normal Keywords:

Created on 2019-12-04 15:17 by castix, last changed 2022-04-11 14:59 by admin.

Messages (2)
msg357807 - (view) Author: castix (castix) Date: 2019-12-04 15:17
Related to https://bugs.python.org/issue27316

This code works from the repl:
Python 3.7.4 (default, Oct  4 2019, 06:57:26) 
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pdb; pdb.set_trace()
--Return--
> <stdin>(1)<module>()->None
(Pdb) z = True
(Pdb) [x for x in [1,2] if z]
[1, 2]
(Pdb) 

However in my (turbogears2) wsgi application it raises:
(Pdb) z = True
(Pdb) [x for x in [1,2] if z]
*** NameError: name 'z' is not defined
(Pdb) z
True
(Pdb) 

I don't know how to report the issue in a reproducible way.
Thanks
msg357840 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-12-05 08:04
I think this is same as https://bugs.python.org/issue26072#msg277578 and is reproducible with below sample script without depending on turbogears. The attached patch in the issue fixes this. Try using interact command from pdb as a workaround.

import pdb

def foo():
  pdb.set_trace()

foo()
History
Date User Action Args
2022-04-11 14:59:23adminsetgithub: 83151
2019-12-05 08:04:29xtreaksetnosy: + xdegaye, xtreak
messages: + msg357840
2019-12-04 15:17:04castixcreate