| { | ||
| CHECK_RELEASED(self); | ||
| if (self->view.readonly) { | ||
| Py_INCREF(self); |
There was a problem hiding this comment.
I think we always need to use mbuf_add_view because of the release() thingy:
>>> b = bytes(10)
>>> m = memoryview(b)
>>> with m.toreadonly() as x:
... pass
...
>>> m[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: operation forbidden on released memoryview object
There was a problem hiding this comment.
Thanks for catching this. It's indeed necessary to create a new object.
- Streamline tests
|
Looks good! |
https://bugs.python.org/issue33176