Skip to content

Specialize self conversion for descriptor slots#5930

Draft
MatthieuDartiailh wants to merge 1 commit intoPyO3:mainfrom
MatthieuDartiailh:descriptor
Draft

Specialize self conversion for descriptor slots#5930
MatthieuDartiailh wants to merge 1 commit intoPyO3:mainfrom
MatthieuDartiailh:descriptor

Conversation

@MatthieuDartiailh
Copy link
Copy Markdown
Contributor

For descriptor slots, CPython does ensure a bad type cannot be passed from Python and the type check can hence be bypassed. This allow to make PyO3 written descriptor closer in performance to equivalent descriptors written in C or C++

…es ensure a bad type cannot be passed from Python
@MatthieuDartiailh MatthieuDartiailh changed the title Speicialize self conversion for descriptor slots Specialize self conversion for descriptor slots Mar 31, 2026
@davidhewitt
Copy link
Copy Markdown
Member

Thanks, see also #4026 which is a similar (draft) PR I started a long time ago and never quite managed to finish off. Generally this optimization applies to more than just descriptors; would you be willing to extend this optimization to the rest of the methods? (That PR has some discussion.)

@MatthieuDartiailh
Copy link
Copy Markdown
Contributor Author

I can try to give your PR a look, yes. But I may not be very fast in doing so.

@davidhewitt
Copy link
Copy Markdown
Member

No worries I haven't made progress on that PR for 2 years, all help is welcome at whatever pace 😂

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants