Skip to content

inspect.{getsourcelines, findsource} return 0 as the starting line number for modules #103319

@artemmukhin

Description

@artemmukhin

Bug report

Run the following program

import inspect
import inspect
_, lineno1 = inspect.getsourcelines(inspect.currentframe())
_, lineno2 = inspect.findsource(inspect.currentframe())
print(lineno1, lineno2)

Expected Result
The line numbers are expected to be 1-based, so the expected output is 1 1.

Actual Result
The actual output is 0 0.

Related discussion: #103226

Your environment

  • CPython versions tested on: main branch
  • Operating system and architecture: macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy