Actions
Bug #22219
openIO::Buffer#free, #resize and #transfer should raise FrozenError if the receiver is frozen
Bug #22219:
IO::Buffer#free, #resize and #transfer should raise FrozenError if the receiver is frozen
Description
Currently IO::Buffer#free, #resize and #transfer can be called even if the receiver is frozen. All three release, reallocate or hand away the memory the buffer references, so they change the state of the buffer. Therefore it seems a bug to me, and these methods should raise FrozenError if the receiver is frozen.
# Current
IO::Buffer.new(4).freeze.free # succeeds, the buffer becomes null
IO::Buffer.new(4).freeze.resize(8) # succeeds, the memory is reallocated
IO::Buffer.new(4).freeze.transfer # succeeds, the receiver becomes null
# Expected
IO::Buffer.new(4).freeze.free # raise FrozenError
IO::Buffer.new(4).freeze.resize(8) # raise FrozenError
IO::Buffer.new(4).freeze.transfer # raise FrozenError
Methods to fix:
IO::Buffer#freeIO::Buffer#resizeIO::Buffer#transfer
Actions