[New-bugs-announce] [issue41097] confusing BufferError: Existing exports of data: object cannot be re-sized

Armin Rigo report at bugs.python.org
Wed Jun 24 03:29:18 EDT 2020


New submission from Armin Rigo <arigo at users.sourceforge.net>:

The behavior (tested in 3.6 and 3.9) of io.BytesIO().getbuffer() gives a unexpected exception message:

>>> b = io.BytesIO()
>>> b.write(b'abc')
3
>>> buf = b.getbuffer()
>>> b.seek(0)
0
>>> b.write(b'?')     # or anything up to 3 bytes
BufferError: Existing exports of data: object cannot be re-sized

The error message pretends that the problem is in resizing the BytesIO object, but the write() is not actually causing any resize.

I am not sure if the bug is a wrong error message (and all writes are supposed to be forbidden) or a wrongly forbidden write() (after all, we can use the buffer itself to write into the same area of memory).

----------
components: Interpreter Core
messages: 372237
nosy: arigo
priority: normal
severity: normal
stage: test needed
status: open
title: confusing BufferError: Existing exports of data: object cannot be re-sized
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41097>
_______________________________________


More information about the New-bugs-announce mailing list