Skip to content

PDB missing function arguments in list comprehension #123141

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

Activity

  1. gaogaotiantian commented on Aug 19, 2024

    @gaogaotiantian
    Member

    dup #65360 and is fixed in main/3.13 by #111094. (PEP 709 accidentally fixed part of the issue so 3.12 works fine in this specific case as well).

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

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions