Quantcast
Channel: Make a memoryview read-only in Python pre-3.8 - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Make a memoryview read-only in Python pre-3.8

$
0
0

Python 3.8 added the memoryview.toreadonly() method. But is there a way to make a read-only memoryview in previous version of python -- specifically Python 3.5 and 3.3?

For a little bit more background, I use memoryviews to share parts of large binary blobs between objects. Sometimes the blob is an in-memory byte object, but sometimes it is also a read/write mmapped file. And I would like to avoid modifications by mistake of the underlying file through the memoryviews.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images