Skip to content

support for readonly buffers (#863) #1466

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

Merged
merged 2 commits into from
Nov 24, 2019
Merged

Conversation

skoslowski
Copy link
Contributor

This adds a readonly flag to buffer_info objects. I consider this a first draft since it only covers the Buffer Protocol portion. Support for readonly in memoryview, array, ... will follow (as separate PRs)

I wanted to get some feedback on this part first:

  • readonly added as default false parameter to not break things
  • the readonly attribute is inserted at the end - consistent with the constructors, but deviating from the order in Py_Buffer.
  • added a const T* constructor with 'readonly=true' - the same could be done for the others, but may require special casing types like nullptr_t

@nedrebo
Copy link

nedrebo commented Nov 19, 2019

Related #1993

@wjakob wjakob merged commit dc65d66 into pybind:master Nov 24, 2019
@wjakob
Copy link
Member

wjakob commented Nov 24, 2019

Merged now, apologies that this took a while.

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.

3 participants