Skip to content

inspect._getmembers duplicates self type in mro for no good reason #99677

@sobolevn

Description

@sobolevn

This line https://github.com/python/cpython/blame/4d82f628c44490d6fbc3f6998d2473d1304d891f/Lib/inspect.py#L540 has this logic mro = (object,) + getmro(object)

I don't think this is correct:

  1. getmro returns MRO including self type
  2. We waste time on doing this
  3. It might backfire at some moment, now it works because of how MRO is used later

Introduced in 86a8a9a

Linked PRs

Metadata

Metadata

Assignees

Labels

stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions