Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
@artemmukhin

Description

@artemmukhin
Issue body actions

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    No fields configured for issues without a type.

    Projects

    Status
    No status
    Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.