GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-140382: Add support for `__getattr__` method to Argument Clinic by StanFromIreland · Pull Request #140376 · python/cpython

Conversation

@StanFromIreland

@StanFromIreland StanFromIreland commented Oct 20, 2025 •
edited by merwok
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Support __getattr__ method in AC #140382

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
StanFromIreland added 2 commits October 19, 2025 17:01
@StanFromIreland
Commit
a1bed00
@StanFromIreland
Blurb
e2502c9
@StanFromIreland
StanFromIreland requested a review from vstinner October 20, 2025 15:50
@StanFromIreland
StanFromIreland requested review from AA-Turner and erlend-aasland as code owners October 20, 2025 15:50
@bedevere-app bedevere-app Bot mentioned this pull request Oct 20, 2025
Misleading __version__ attribute of modules in standard library #76007
Closed
@bedevere-app bedevere-app Bot added the awaiting review label Oct 20, 2025
@StanFromIreland StanFromIreland mentioned this pull request Oct 20, 2025
gh-76007: Deprecate zlib.__version__ attribute #140130
Merged
@merwok

merwok commented Oct 20, 2025

Copy link
Copy Markdown
Member

Could you create a new issue for this, and tag people interested in AC?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland

StanFromIreland commented Oct 20, 2025

Copy link
Copy Markdown
Member Author

I can create a new issue, but all CODEOWNERs have already been notified. Do you have anyone else in mind?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland StanFromIreland changed the title gh-76007: Add support for __getattr__ method to Argument Clinic gh-140382: Add support for __getattr__ method to Argument Clinic Oct 20, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Oct 20, 2025
Support __getattr__ method in AC #140382
Closed
@StanFromIreland
Update blurb name for new issue
5c307e5
ZeroIntensity
ZeroIntensity reviewed Oct 20, 2025
View reviewed changes

@ZeroIntensity ZeroIntensity left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Wouldn't it make more sense to just support arbitrary dunder methods? __getattr__ isn't very common in C code, among other things.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

skirpichev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@AA-Turner

AA-Turner commented Oct 20, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

I'm also not convinced this is worth it. __getattr__() really ought to be implemented at the Python level, modules implemented entirely in C (like zlib) are very much a special case, and aren't used for new stdlib modules.

A

ZeroIntensity reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ZeroIntensity

ZeroIntensity commented Oct 20, 2025

Copy link
Copy Markdown
Member

On the other hand, I would be very supportive of allowing arbitrary dunders in AC, though I suspect that would be a lot of extra work (because we would need to map dunders to PyTypeObject fields).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@merwok

merwok commented Oct 20, 2025

Copy link
Copy Markdown
Member

I can create a new issue, but all CODEOWNERs have already been notified. Do you have anyone else in mind?

No, it’s just the general principle that «should we do?» discussions happen in issues (and when needed on the forums), then the PR can host «how to do?» discussions.

StanFromIreland, AA-Turner, and skirpichev reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

skirpichev
skirpichev reviewed Oct 21, 2025
View reviewed changes

@skirpichev skirpichev left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Wouldn't it make more sense to just support arbitrary dunder methods?

I think it's ok to add support of specific dunders on-demand. It's not too helpful in general, because sometimes we can do too much with slots, even override the docstring.

But please think about more generic case. For example, for most dunders we have very specific function signatures. It will be redundant and error-prone to specify this stuff by hand.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Modules/zlibmodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland
Convert name to str
9a7202c
@vstinner

vstinner commented Oct 28, 2025

Copy link
Copy Markdown
Member

Wouldn't it make more sense to just support arbitrary dunder methods? getattr isn't very common in C code, among other things.

I would prefer to only add support when it will really be needed, so we can test on actual code rather than unit tests. In short, I'm supportive of only adding support for __getattr__() for now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ZeroIntensity

ZeroIntensity commented Oct 28, 2025

Copy link
Copy Markdown
Member

I don't think that will work well in practice. Judging by this PR, adding support for a new dunder method seems non-trivial. People will probably decide to just write things the old way instead of updating clinic, which we don't want.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland

StanFromIreland commented Mar 7, 2026

Copy link
Copy Markdown
Member Author

Closing, there is little need and support for this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StanFromIreland StanFromIreland closed this Mar 7, 2026
@StanFromIreland
StanFromIreland deleted the ac_getattr branch March 7, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@skirpichev skirpichev skirpichev left review comments
@ZeroIntensity ZeroIntensity ZeroIntensity left review comments
@vstinner vstinner Awaiting requested review from vstinner
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland erlend-aasland is a code owner
@AA-Turner AA-Turner Awaiting requested review from AA-Turner AA-Turner is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting review

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@StanFromIreland @merwok @AA-Turner @ZeroIntensity @vstinner @skirpichev
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.