Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

inspect.getsource (findsource) not working as expected when duplicate class is used #106727

Closed
Labels
stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error
@Viicos

Description

@Viicos

Bug report

Consider the following example:

importinspectclassModel:a=1classModel:a=2print(Model.a)#> 2print(inspect.getsource(Model))#> class Model:#>     a = 1

I think we should expect the last class to be used (it works as expected if we use functions instead of classes).

This issue was raised in an external project:

And I'm facing this issue while working on:

Let me know if this should be fixed, I'll take a deeper look at what was done in#10307 and see if I can make a PR

Your environment

  • CPython versions tested on: 3.11.4
  • Operating system and architecture: Ubuntu

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp