[ruby-core:105699] [Ruby master Bug#17146] Queue operations are allowed after it is frozen
From:
"Eregon (Benoit Daloze)" <noreply@...>
Date:
2021-10-20 15:53:22 UTC
List:
ruby-core #105699
Issue #17146 has been updated by Eregon (Benoit Daloze). OK, that `no benefit to changing the behavior.` was not reported here but I guess it's in the dev meeting log. Benefit is consistency and being able to design deep freezing/immutable without making an exception for Queue. Every time deep freezing/immutable comes up, this comes up as well as a problem. I argue the current behavior is useful to nobody, and it's highly inconsistent, i.e., let's fix it. ---------------------------------------- Bug #17146: Queue operations are allowed after it is frozen https://bugs.ruby-lang.org/issues/17146#change-94198 * Author: Eregon (Benoit Daloze) * Status: Open * Priority: Normal * ruby -v: ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- ``` [1] pry(main)> q = Queue.new => #<Thread::Queue:0x000056263683aee8> [2] pry(main)> q.freeze => #<Thread::Queue:0x000056263683aee8> [3] pry(main)> q << 1 => #<Thread::Queue:0x000056263683aee8> [4] pry(main)> q.pop => 1 [5] pry(main)> q.frozen? => true ``` Found by @ko1 in https://bugs.ruby-lang.org/issues/17100#note-28 I think it's a bug, since those are clear mutations. I guess old Thread::Queue implemented in Ruby did not have this bug. -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>