GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pdb shows wrong line numbers for modules · Issue #103225 · python/cpython

pdb shows wrong line numbers for modules #103225

New issue
Copy link
New issue
Copy link
Closed
Closed
pdb shows wrong line numbers for modules#103225
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@artemmukhin
artemmukhin
opened on Apr 3, 2023
Issue body actions

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

  • GH-103319: Fix inspect.getsourcelines() to return 1-based line numbers #103226
  • gh-103225: Fixed zero lineno issue for pdb #103265
  • [3.11] gh-103225: Fixed zero lineno issue for pdb (#103265) #104262
Reacted by Oleg Iarygin and Erik Cervin Edin

Activity

  1. artemmukhin
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Apr 3, 2023
  2. artemmukhin
    added a commit that references this issue on Apr 3, 2023

    pythonGH-103225: Fix `inspect.getsourcelines()` to return 1-based lin…

    25585fc
  3. iritkatriel
    added a commit that references this issue on Apr 7, 2023

    gh-103225: Fixed zero lineno issue for pdb (#103265)

    2667452
  4. warsaw
    added a commit that references this issue on Apr 11, 2023

    pythongh-103225: Fixed zero lineno issue for pdb (python#103265)

    b119d39
  5. gaogaotiantian
    added a commit that references this issue on May 7, 2023

    pythongh-103225: Fixed zero lineno issue for pdb (python#103265)

    c1254e4
  6. iritkatriel
    added a commit that references this issue on May 7, 2023

    [3.11] gh-103225: Fixed zero lineno issue for pdb (#103265) (#104262)

    19abf69
  7. hauntsaninja commented on May 8, 2023

    @hauntsaninja
    hauntsaninja
    on May 8, 2023
    Contributor
    More actions

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

  8. hauntsaninja
    closed this as completedon May 8, 2023
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 errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.