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

bpo-46140: take more Py_buffer arguments as const * #30217

Merged
merged 4 commits into from
Dec 22, 2021

Conversation

davidhewitt
Copy link
Contributor

@davidhewitt davidhewitt commented Dec 20, 2021

Changes PyBuffer_GetPointer, PyBuffer_FromContiguous, PyBuffer_ToContiguous and PyMemoryView_FromBuffer to take buffer info by const Py_buffer * instead of Py_buffer *, as they do not need mutability.

PyBuffer_FromContiguous also now takes the source buffer as const void *, and similarly PyBuffer_GetPointer takes the strides as const Py_ssize_t *.

Finally, corrects the documentation for PyBuffer_IsContiguous, which already took const Py_buffer * (but was documented as Py_buffer *).

https://bugs.python.org/issue46140

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. Please add a NEWS entry.

@davidhewitt
Copy link
Contributor Author

Thanks - news entry added!

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

👍

@serhiy-storchaka serhiy-storchaka merged commit 31ff967 into python:main Dec 22, 2021
@davidhewitt davidhewitt deleted the const-buffer branch December 22, 2021 13:12
brandtbucher pushed a commit to brandtbucher/cpython that referenced this pull request Dec 27, 2021
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.

5 participants