ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:124833] [Ruby Bug#21882] IO::Buffer#locked leaves the buffer locked when the block raises
@ 2026-02-15 16:39 hanazuki (Kasumi Hanazuki) via ruby-core
  2026-02-15 16:44 ` [ruby-core:124834] " hanazuki (Kasumi Hanazuki) via ruby-core
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: hanazuki (Kasumi Hanazuki) via ruby-core @ 2026-02-15 16:39 UTC (permalink / raw)
  To: ruby-core; +Cc: hanazuki (Kasumi Hanazuki)

Issue #21882 has been reported by hanazuki (Kasumi Hanazuki).

----------------------------------------
Bug #21882: IO::Buffer#locked leaves the buffer locked when the block raises
https://bugs.ruby-lang.org/issues/21882

* Author: hanazuki (Kasumi Hanazuki)
* Status: Open
* ruby -v: ruby 4.0.1 (2026-01-13 revision e04267a14b) +PRISM [x86_64-linux]
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN
----------------------------------------
`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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:124834] [Ruby Bug#21882] IO::Buffer#locked leaves the buffer locked when the block raises
  2026-02-15 16:39 [ruby-core:124833] [Ruby Bug#21882] IO::Buffer#locked leaves the buffer locked when the block raises hanazuki (Kasumi Hanazuki) via ruby-core
@ 2026-02-15 16:44 ` hanazuki (Kasumi Hanazuki) via ruby-core
  2026-02-16  3:13 ` [ruby-core:124836] " nobu (Nobuyoshi Nakada) via ruby-core
  2026-02-16  4:24 ` [ruby-core:124837] " hanazuki (Kasumi Hanazuki) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: hanazuki (Kasumi Hanazuki) via ruby-core @ 2026-02-15 16:44 UTC (permalink / raw)
  To: ruby-core; +Cc: hanazuki (Kasumi Hanazuki)

Issue #21882 has been updated by hanazuki (Kasumi Hanazuki).


Patch: https://github.com/ruby/ruby/pull/16180

----------------------------------------
Bug #21882: IO::Buffer#locked leaves the buffer locked when the block raises
https://bugs.ruby-lang.org/issues/21882#change-116453

* Author: hanazuki (Kasumi Hanazuki)
* Status: Open
* ruby -v: ruby 4.0.1 (2026-01-13 revision e04267a14b) +PRISM [x86_64-linux]
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN
----------------------------------------
`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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:124836] [Ruby Bug#21882] IO::Buffer#locked leaves the buffer locked when the block raises
  2026-02-15 16:39 [ruby-core:124833] [Ruby Bug#21882] IO::Buffer#locked leaves the buffer locked when the block raises hanazuki (Kasumi Hanazuki) via ruby-core
  2026-02-15 16:44 ` [ruby-core:124834] " hanazuki (Kasumi Hanazuki) via ruby-core
@ 2026-02-16  3:13 ` nobu (Nobuyoshi Nakada) via ruby-core
  2026-02-16  4:24 ` [ruby-core:124837] " hanazuki (Kasumi Hanazuki) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2026-02-16  3:13 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #21882 has been updated by nobu (Nobuyoshi Nakada).


`buf.locked {break}` also leaves it locked.
Could you add a test for this case too?

----------------------------------------
Bug #21882: IO::Buffer#locked leaves the buffer locked when the block raises
https://bugs.ruby-lang.org/issues/21882#change-116456

* Author: hanazuki (Kasumi Hanazuki)
* Status: Open
* ruby -v: ruby 4.0.1 (2026-01-13 revision e04267a14b) +PRISM [x86_64-linux]
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN
----------------------------------------
`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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:124837] [Ruby Bug#21882] IO::Buffer#locked leaves the buffer locked when the block raises
  2026-02-15 16:39 [ruby-core:124833] [Ruby Bug#21882] IO::Buffer#locked leaves the buffer locked when the block raises hanazuki (Kasumi Hanazuki) via ruby-core
  2026-02-15 16:44 ` [ruby-core:124834] " hanazuki (Kasumi Hanazuki) via ruby-core
  2026-02-16  3:13 ` [ruby-core:124836] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2026-02-16  4:24 ` hanazuki (Kasumi Hanazuki) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: hanazuki (Kasumi Hanazuki) via ruby-core @ 2026-02-16  4:24 UTC (permalink / raw)
  To: ruby-core; +Cc: hanazuki (Kasumi Hanazuki)

Issue #21882 has been updated by hanazuki (Kasumi Hanazuki).


Thank you for your review, nobu. I added test cases for break and throw.

----------------------------------------
Bug #21882: IO::Buffer#locked leaves the buffer locked when the block raises
https://bugs.ruby-lang.org/issues/21882#change-116457

* Author: hanazuki (Kasumi Hanazuki)
* Status: Open
* ruby -v: ruby 4.0.1 (2026-01-13 revision e04267a14b) +PRISM [x86_64-linux]
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN
----------------------------------------
`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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-02-16  4:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-15 16:39 [ruby-core:124833] [Ruby Bug#21882] IO::Buffer#locked leaves the buffer locked when the block raises hanazuki (Kasumi Hanazuki) via ruby-core
2026-02-15 16:44 ` [ruby-core:124834] " hanazuki (Kasumi Hanazuki) via ruby-core
2026-02-16  3:13 ` [ruby-core:124836] " nobu (Nobuyoshi Nakada) via ruby-core
2026-02-16  4:24 ` [ruby-core:124837] " hanazuki (Kasumi Hanazuki) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).