From: "Eregon (Benoit Daloze)" Date: 2021-10-20T14:23:02+00:00 Subject: [ruby-core:105695] [Ruby master Bug#17146] Queue operations are allowed after it is frozen Issue #17146 has been updated by Eregon (Benoit Daloze). Status changed from Closed to Open Why was this closed? I think there is only one rational answer here: `Queue#freeze` should prevent mutations to the Queue just like for Array/Hash/etc. There is no other "nested object" (i.e., the queue contents) exposed to user code, so it would just be weird if `Queue#deep_freeze` would actually prevent mutation of the queue but `Queue#freeze` does not. "deep freeze" should be equivalent to calling `freeze` on each object in an object graph, this can't work if `Queue#freeze` doesn't prevent mutations. ---------------------------------------- Bug #17146: Queue operations are allowed after it is frozen https://bugs.ruby-lang.org/issues/17146#change-94194 * 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 => # [2] pry(main)> q.freeze => # [3] pry(main)> q << 1 => # [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: