New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deallocation scheme for memoryview is unsafe #69711
Comments
Deallocation scheme for memoryview is complex and unsafe. It crashes with chained memoryviews (bpo-25498), but I suppose deallocating unchained memoryview can crash too if the memoryview itself had exported buffers (self->exports != 0). Both memoryview and ManagedBuffer support garbage collector. If there is a reference to memoryview from reference loop, memoryview becomes a part of the reference loop.
First garbage collector calls tp_clear for all objects in the loop (memory_clear() for memoryview). Following patch makes deallocation scheme for memoryview simpler and more reliable.
|
The "chained memoryviews" you refer to are a hack and simply |
Did you forget your patch? :) |
Yes, the "chained memoryviews" in ctypes are a hack and it will be eliminated. But this hack exposed possible weak point in memoryview. |
WTF? Where is my patch? |
Strange bug. I can't attach any file. |
I don't understand:
Please state the code path clearly. |
|
First of all, the premise "exports > 0" in your example looks wrong In fact, the check for "exports > 0" is for the case when Secondly, even if it did happen (show the code path leading Lastly, I don't find it very diplomatic to use language like "Deallocation scheme for memoryview is complex and unsafe. It |
Sorry for my bad wording. I wasn't going to blame or insult anybody. |
Thanks, no big problem. The thing is that the parts I wrote There are even tests in test_memoryview() / test_buffer() for So I'd really prefer not to have things labeled as potential issues Thus, I'll probably revert that at some point, not out of |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: