From: "rwstauner (Randy Stauner) via ruby-core" Date: 2026-06-26T21:18:09+00:00 Subject: [ruby-core:125853] [Ruby Bug#21882] IO::Buffer#locked leaves the buffer locked when the block raises Issue #21882 has been updated by rwstauner (Randy Stauner). Backport PR for ruby_4_0 (4.0) opened: https://github.com/ruby/ruby/pull/17513 ---------------------------------------- Bug #21882: IO::Buffer#locked leaves the buffer locked when the block raises https://bugs.ruby-lang.org/issues/21882#change-117774 * Author: hanazuki (Kasumi Hanazuki) * Status: Closed * ruby -v: ruby 4.0.1 (2026-01-13 revision e04267a14b) +PRISM [x86_64-linux] * Backport: 3.3: REQUIRED, 3.4: DONE, 4.0: REQUIRED ---------------------------------------- `IO::Buffer#locked` should unlock the buffer even after the block raises an exception. ```ruby buf = IO::Buffer.new(100) buf.locked { fail } rescue nil buf.locked { p :ok } # expected to print :ok, but actually raises a LockedError ``` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/