Richard Oudkerk added the comment: > You would need to call memory_release(). Perhaps we can just expose it on the > C-API level as PyMemoryView_Release().
Should PyMemoryView_Release() release the _PyManagedBufferObject by doing mbuf_release(view->mbuf) even if view->mbuf->exports > 0? Doing Py_TYPE(view->mbuf)->tp_clear((PyObject *)view->mbuf); seems to have the desired effect of causing ValueError when I try to access any associated memoryview. > 3) A piece of memory needs to be packaged as a memoryview with automatic > cleanup in mbuf_dealloc(): > > PyMemoryView_FromBufferWithCleanup() (proposed in msg169613) Maybe this should also handle decrefing the base object (given a flag PyManagedBuffer_FreeObj). I do worry about creating memoryviews that survive deallocation of the base object. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue15903> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com