Skip to content

pdb shows wrong line numbers for modules #103225

Closed

Description

@artemmukhin

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

Activity

  1. added a commit that references this issue on Apr 3, 2023
  2. added a commit that references this issue on Apr 7, 2023
  3. added a commit that references this issue on Apr 11, 2023
  4. added a commit that references this issue on May 7, 2023
  5. added a commit that references this issue on May 7, 2023
  6. hauntsaninja commented on May 8, 2023

    @hauntsaninja
    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

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