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
forked frompython/cpython

Implement PyInterface prototype#44

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
zooba wants to merge4 commits intomain
base:main
Choose a base branch
Loading
fromslots
Draft

Implement PyInterface prototype#44

zooba wants to merge4 commits intomainfromslots

Conversation

@zooba
Copy link
Owner

@zoobazooba commentedSep 16, 2025
edited
Loading

This is very high-level, speculative, having a look at how an implementation ofcapi-workgroup/api-revolution#4 might look.

Don't take this too seriously (yet) ;)

@encukou
Copy link

Thank you for implementing it!
My biggest worry/confusion is the same as in the revolution issue: how does this work with subclassing & inheritance, and how that would interact with third-patry extensions.

@zooba
Copy link
OwnerAuthor

Great questions, I haven't gone through enough real examples of that to be certain, but my gut feel would be:

  • when subclassing a native type with a pure-Python type, you can't override thetp_getinterface slot anyway
  • when subclassing with another native type, you have to know what your base class is, and so can look up itstp_getinterface and delegate explicitly
  • as with all other native slot implementations, they will only support subclassing if they are written to do so, and can reject subclassing by testing their own type
  • also, native type inheritance is a nightmare and you'll sleep better if you just don't do it :)

I'm not sure whether we should be adding guidance to recommend actively rejecting subclasses intp_getinterface implementations, though it probably makes more sense to do that than to try and make every interface implementation go through slow paths in order to support it. Let fast be fast, and let the fallbacks handle subclasses.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@zooba@encukou

[8]ページ先頭

©2009-2025 Movatter.jp