Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PDB missing function arguments in list comprehension #123141

Closed as not planned
Closed as not planned
@LukasKapp-Schwoerer

Description

@LukasKapp-Schwoerer

Bug report

Bug description:

Description

If PDB is executed within a function trace and function argument arg is defined, executing [arg for _ in [0]] within PDB throws NameError: name 'arg' is not defined.

To reproduce

import pdb

def fun(t):
  print([t for _ in [0]])
  pdb.set_trace()

fun(42)

Execute the code until PDB breaks upon pdb.set_trace(). In PDB, executing t will return 42, but executing [t for _ in [0]] throws NameError: name 't' is not defined:

Log

[42]
--Return--
> /home/main.py(5)fun()->None
-> pdb.set_trace()
(Pdb) t
42
(Pdb) [t for _ in [0]]
*** NameError: name 't' is not defined

Tested locally on 3.11.9 and on https://www.onlinegdb.com/online_python_debugger.

CPython versions tested on:

3.11

Operating systems tested on:

Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions