Skip to content

pdb: can't debug a script with arguments #125115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Jamim opened this issue Oct 8, 2024 · 2 comments
Closed

pdb: can't debug a script with arguments #125115

Jamim opened this issue Oct 8, 2024 · 2 comments
Assignees
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@Jamim
Copy link

Jamim commented Oct 8, 2024

Bug report

Bug description:

Hello everyone,

With Python 3.13, pdb doesn't pass arguments like -b or --bar to a script while it works fine with Python 3.12.

test.py

import sys

print(' '.join(sys.argv))

✅ Good:

$ python3.13 -m pdb -c continue -c quit test.py foo
test.py foo
The program finished and will be restarted

🐛 Bad:

$ python3.13 -m pdb -c continue -c quit test.py foo --bar
usage: pdb [-h] [-c command] (-m module | pyfile) [args ...]
pdb: error: unrecognized arguments: --bar

✅ Good:

$ python3.12 -m pdb -c continue -c quit test.py foo --bar
test.py foo --bar
The program finished and will be restarted

Best regards!

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

@Jamim Jamim added the type-bug An unexpected behavior, bug, or error label Oct 8, 2024
@tomasr8 tomasr8 added stdlib Python modules in the Lib dir 3.13 bugs and security fixes labels Oct 8, 2024
@gaogaotiantian gaogaotiantian self-assigned this Oct 8, 2024
@gaogaotiantian
Copy link
Member

Yes that's a bug when pdb switched to argparse. I'll fix it but It would be in the next 3.13 release. In the meantime, you should be able to explicitly pass the argument to the script instead of pdb by ./python -m pdb -c continue -c quit -- test.py foo --bar

@gaogaotiantian
Copy link
Member

Fixed in #125424

gaogaotiantian added a commit that referenced this issue Oct 15, 2024
…d of fail (GH-125424) (#125547)

gh-125115: Pass unknown pdb command line args to script instead of fail (GH-125424)
(cherry picked from commit 9c2bb7d)

Co-authored-by: Tian Gao <[email protected]>
Co-authored-by: Irit Katriel <[email protected]>
ebonnal pushed a commit to ebonnal/cpython that referenced this issue Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants