BufferError when using memoryview
See original GitHub issueI noticed this when trying to use yappi with tornado. Here is a simple repro:
import yappi
yappi.start()
def test_mem():
buf = bytearray()
buf += b't' * 200
view = memoryview(buf)[10:].tobytes()
del buf[:10]
return view
if __name__ == "__main__":
test_mem()
Without yappi, the code completes successfully. With yappi I get the following error:
Traceback (most recent call last):
File "yappi_repro.py", line 14, in <module>
test_mem()
File "yappi_repro.py", line 9, in test_mem
del buf[:10]
BufferError: Existing exports of data: object cannot be re-sized
Reproducible on python 3.6, 3.7 and 3.8. I have not tried python 2.7
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Python Exception Handling - BufferError - Airbrake Blog
The BufferError occurs when a problem arises while working with any sort of memory buffer within Python. Specifically, classes like memoryview ...
Read more >BufferError: memoryview has 1 exported buffer : PY-54447
Type the following python code and debug it with a breakpoint at the last line: import random from concurrent.futures import wait, ALL_COMPLETED, ...
Read more >python - Example to throw a BufferError - Stack Overflow
From the 3.3 source code, I see the following error messages being used for BufferError : memoryview : underlying buffer is not writable...
Read more >Buffers and Memoryview Objects — Python 2.7.2 documentation
These errors should be a BufferError unless there is another error that is actually causing the problem. The exporter can use flags information...
Read more >Issue 15994: memoryview to freed memory can cause segfault
A memoryview which does not own a reference to its base object can ... coincide with view) view[0] = 0 # overwrite first...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Confirmed #61 fixes the issue, thanks @sumerc!
That’s great, thanks for being so responsive. I’m happy to test your changes - currently I have this hack in place to unblock my progress