Skip to content

pdb shows wrong line numbers for modules #103225

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
artemmukhin opened this issue Apr 3, 2023 · 1 comment
Closed

pdb shows wrong line numbers for modules #103225

artemmukhin opened this issue Apr 3, 2023 · 1 comment
Labels
type-bug An unexpected behavior, bug, or error

Comments

@artemmukhin
Copy link
Contributor

artemmukhin commented Apr 3, 2023

Bug report

  1. Create foo.py containing a = 1
  2. ./python -m pdb foo.py

Results in

./python -m pdb foo.py
./foo.py(1)<module>()
-> a = 1
(Pdb) longlist
  0     a = 1
(Pdb) 

The line number should be 1 instead of 0.

This occurs because the longlist command uses inspect.getsourcelines, which returns 0 as the starting line number for modules.

This bug was introduced in #101674.

Your environment

  • CPython versions tested on: main

Linked PRs

@artemmukhin artemmukhin added the type-bug An unexpected behavior, bug, or error label Apr 3, 2023
artemmukhin added a commit to artemmukhin/cpython that referenced this issue Apr 3, 2023
iritkatriel pushed a commit that referenced this issue Apr 7, 2023
warsaw pushed a commit to warsaw/cpython that referenced this issue Apr 11, 2023
gaogaotiantian added a commit to gaogaotiantian/cpython that referenced this issue May 7, 2023
iritkatriel pushed a commit that referenced this issue May 7, 2023
gh-103225: Fixed zero lineno issue for pdb (#103265)

Co-authored-by: Artem Mukhin <[email protected]>
@hauntsaninja
Copy link
Contributor

Thanks for reporting! Closing, since the pdb issue is fixed and #103319 can track whether we want to change behaviour in inspect or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants