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

Check buffer protocol support before getting buffer in sequence protocol specialization #1502

Merged
merged 1 commit into from
Mar 16, 2021

Conversation

messense
Copy link
Member

@messense messense commented Mar 16, 2021

This avoids calling a expensive PyErr_Format inside of PyObject_GetBuffer when buffer protocol is unsupported

…col specialization

This avoids calling a expensive `PyErr_Format` inside of
`PyObject_GetBuffer` when buffer protocol is unsupported
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Minor further suggestion.

Also tbh I'm not a fan of the nightly feature and probably wouldn't recommend it for users trying to get performance. Specialization is known to have soundness holes; I don't know if it's possible for users to hit them with our unstable implementations but I don't want to have to debug that 😅

src/types/sequence.rs Show resolved Hide resolved
@messense messense merged commit c0d4905 into PyO3:master Mar 16, 2021
@messense messense deleted the check-buffer branch March 16, 2021 08:17
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