Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sobolevn opened this issue Nov 22, 2022 · 0 comments
Closed

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

sobolevn opened this issue Nov 22, 2022 · 0 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Nov 22, 2022

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

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error stdlib Python modules in the Lib dir labels Nov 22, 2022
@sobolevn sobolevn self-assigned this Nov 22, 2022
sobolevn added a commit to sobolevn/cpython that referenced this issue Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant