Skip to content

Add memoryview constructors for PyMemoryView_FromMemory #1998

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

Closed
wants to merge 1 commit into from
Closed

Add memoryview constructors for PyMemoryView_FromMemory #1998

wants to merge 1 commit into from

Conversation

pwuertz
Copy link
Contributor

@pwuertz pwuertz commented Nov 20, 2019

I was looking for a way to expose a simple memoryview to python, i.e. pointer + size without additional overhead. PyMemoryView_FromMemory() seems to be well suited for this, but pybind11 has no matching constructor for it.

I added two alternative constructors for py::memoryview using the FromMemory creator, allowing for read/write access or read-only if const classified.

@pwuertz pwuertz changed the title Add memoryview constructors for PyMemoryView_FromBuffer Add memoryview constructors for PyMemoryView_FromMemory Nov 20, 2019
@pwuertz
Copy link
Contributor Author

pwuertz commented Dec 17, 2019

Rebased to current master

@virtuald
Copy link
Contributor

This was implemented in e248869

@YannickJadoul
Copy link
Collaborator

Indeed; see #2223. Sorry this wasn't dealt with in time, @pwuertz :-/
Thanks for pointing this out, @virtuald!

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