Skip to content

gh-150506: Improve inspect.getattr_static example code#150507

Open
jonathandung wants to merge 2 commits into
python:mainfrom
jonathandung:patch-6
Open

gh-150506: Improve inspect.getattr_static example code#150507
jonathandung wants to merge 2 commits into
python:mainfrom
jonathandung:patch-6

Conversation

@jonathandung

@jonathandung jonathandung commented May 27, 2026

Copy link
Copy Markdown
Contributor

@bedevere-app bedevere-app Bot added docs Documentation in the Doc dir skip news labels May 27, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Docs PRs May 27, 2026
@jonathandung jonathandung changed the title gh-150506: Make inspect.getattr_static example code in [documentation page](https://docs.python.org/3/library/inspect.html#inspect.getattr_static) work correctly gh-150506: Make inspect.getattr_static example code in documentation page work correctly May 27, 2026
@jonathandung

Copy link
Copy Markdown
Contributor Author

See the page

@read-the-docs-community

read-the-docs-community Bot commented May 27, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33445350 | 📁 Comparing 50f27f9 against main (776573c)

  🔍 Preview build  

183 files changed · + 2 added · ± 180 modified · - 1 deleted

+ Added

± Modified

- Deleted

@picnixz picnixz changed the title gh-150506: Make inspect.getattr_static example code in documentation page work correctly gh-150506: Improve inspect.getattr_static example code May 27, 2026
Comment thread Doc/library/inspect.rst Outdated
wrapper_descriptor = type(str.__dict__['__add__'])
descriptor_types = (slot_descriptor, getset_descriptor, wrapper_descriptor)
import types
descriptor_types = (types.MemberDescriptorType, types.GetSetDescriptorType, types.WrapperDescriptorType)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put it in the isinstance check instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

I remember there are also method_descriptor and classmethod_descriptor. Are they relevant here?

Originally posted by @jonathandung in #150504 (comment)

@jonathandung jonathandung requested a review from picnixz July 5, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants