Skip to content

[PDB] NameError in list comprehension in PDB #83151

Description

@castix
mannequin
BPO 38970
Nosy @xdegaye, @tirkarthi

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2019-12-04.15:17:03.998>
labels = ['3.7', 'type-bug', 'library']
title = '[PDB] NameError in list comprehension in PDB'
updated_at = <Date 2019-12-05.08:04:29.609>
user = 'https://bugs.python.org/castix'

bugs.python.org fields:

activity = <Date 2019-12-05.08:04:29.609>
actor = 'xtreak'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2019-12-04.15:17:03.998>
creator = 'castix'
dependencies = []
files = []
hgrepos = []
issue_num = 38970
keywords = []
message_count = 2.0
messages = ['357807', '357840']
nosy_count = 3.0
nosy_names = ['xdegaye', 'xtreak', 'castix']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue38970'
versions = ['Python 3.7']

Linked PRs

Activity

  1. castix commented on Dec 4, 2019

    castixmannequin
    MannequinAuthor

    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

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    type-bugAn unexpected behavior, bug, or error
    on Dec 4, 2019
  3. tirkarthi commented on Dec 5, 2019

    @tirkarthi
    Member

    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()
  4. transferred this issue fromon Apr 10, 2022
  5. added a commit that references this issue on May 6, 2024
  6. gaogaotiantian commented on May 6, 2024

    @gaogaotiantian
    Member

    This is fixed by PEP 709.

  7. added a commit that references this issue on May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.7 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions