Project

General

Profile

Actions

Bug #21882

closed

IO::Buffer#locked leaves the buffer locked when the block raises

Bug #21882: IO::Buffer#locked leaves the buffer locked when the block raises

Added by hanazuki (Kasumi Hanazuki) 7 days ago. Updated 3 days ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 4.0.1 (2026-01-13 revision e04267a14b) +PRISM [x86_64-linux]
[ruby-core:124833]

Description

IO::Buffer#locked should unlock the buffer even after the block raises an exception.

buf = IO::Buffer.new(100)
buf.locked { fail } rescue nil
buf.locked { p :ok }  # expected to print :ok, but actually raises a LockedError
Actions

Also available in: PDF Atom