[issue25525] Deallocation scheme for memoryview is unsafe

2015-11-02 Thread Stefan Krah
Stefan Krah added the comment: Thanks, no big problem. The thing is that the parts I wrote (Modules/_decimal/*, Objects/memoryobject.c, Modules/_testbuffer.c) have been audited rather heavily and have 100% code coverage with a privately maintained patch that inserts allocation failures. There a

[issue25525] Deallocation scheme for memoryview is unsafe

2015-11-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sorry for my bad wording. I wasn't going to blame or insult anybody. -- ___ Python tracker ___ ___

[issue25525] Deallocation scheme for memoryview is unsafe

2015-11-01 Thread Stefan Krah
Stefan Krah added the comment: First of all, the premise "exports > 0" in your example looks wrong to me. The deallocation process for the first view should start precisely when it no longer has any exports. In fact, the check for "exports > 0" is for the case when memoryview.release() is call

[issue25525] Deallocation scheme for memoryview is unsafe

2015-11-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: 1) memory_clear() 2) _memory_release() 3) if self->exports > 0 then BufferError (but ignored). 4) Py_CLEAR(self->mbuf) 5) memory_dealloc() 6) _memory_release() 7) self->mbuf->exports where self->mbuf == NULL -- __

[issue25525] Deallocation scheme for memoryview is unsafe

2015-11-01 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- keywords: +patch Added file: http://bugs.python.org/file40917/memoryview_safer_clearing.patch ___ Python tracker ___

[issue25525] Deallocation scheme for memoryview is unsafe

2015-11-01 Thread Stefan Krah
Stefan Krah added the comment: > First garbage collector calls tp_clear for all objects in the loop > (memory_clear() for memoryview). If self->exports != 0 for memoryview, _memory_release() fails and the _Py_MEMORYVIEW_RELEASED flag is not set. I don't understand: 1) memory_clear() 2) _

[issue25525] Deallocation scheme for memoryview is unsafe

2015-10-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Strange bug. I can't attach any file. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue25525] Deallocation scheme for memoryview is unsafe

2015-10-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: WTF? Where is my patch? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue25525] Deallocation scheme for memoryview is unsafe

2015-10-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, the "chained memoryviews" in ctypes are a hack and it will be eliminated. But this hack exposed possible weak point in memoryview. -- ___ Python tracker ___

[issue25525] Deallocation scheme for memoryview is unsafe

2015-10-31 Thread Martin Panter
Martin Panter added the comment: Did you forget your patch? :) -- nosy: +martin.panter ___ Python tracker ___ ___ Python-bugs-list mai

[issue25525] Deallocation scheme for memoryview is unsafe

2015-10-31 Thread Stefan Krah
Stefan Krah added the comment: The "chained memoryviews" you refer to are a hack and simply aren't supported. Please stop spreading FUD. -- ___ Python tracker ___ ___

[issue25525] Deallocation scheme for memoryview is unsafe

2015-10-31 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Deallocation scheme for memoryview is complex and unsafe. It crashes with chained memoryviews (issue25498), but I suppose deallocating unchained memoryview can crash too if the memoryview itself had exported buffers (self->exports != 0). Both memoryview a