Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/pybind11/pytypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ class buffer : public object {

class memoryview : public object {
public:
explicit memoryview(const buffer_info& info) {
explicit memoryview(const buffer_info& info, bool readonly=false) {
static Py_buffer buf { };
// Py_buffer uses signed sizes, strides and shape!..
static std::vector<Py_ssize_t> py_strides { };
Expand All @@ -1261,7 +1261,7 @@ class memoryview : public object {
buf.strides = py_strides.data();
buf.shape = py_shape.data();
buf.suboffsets = nullptr;
buf.readonly = false;
buf.readonly = readonly;
buf.internal = nullptr;

m_ptr = PyMemoryView_FromBuffer(&buf);
Expand Down