Martin Panter added the comment:

I think idea 2 (error if memoryview not released) would not work. It would rely 
on garbage collection, which is not always immediate. E.g. if the memoryview 
were kept alive by a reference cycle, it may not immediately be released. I 
don’t think idea 3 is worthwhile, because the memoryview API does not seem 
designed for this use case, and it would not be 100% consistent anyway.

So that leaves my first idea, to call view.release() when readinto(), etc, 
return. This should avoid the crash and data loss problems in some common 
cases. It is implemented in release-view.patch, along with some notes.

----------
components: +Unicode
keywords: +patch
nosy: +ezio.melotti, haypo
stage:  -> patch review
Added file: http://bugs.python.org/file42503/release-view.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue15994>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to