ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: "Eregon (Benoit Daloze)" <noreply@ruby-lang.org>
To: ruby-core@ruby-lang.org
Subject: [ruby-core:105699] [Ruby master Bug#17146] Queue operations are allowed after it is frozen
Date: Wed, 20 Oct 2021 15:53:22 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-94198.20211020155321.772@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-17146.20200903225323.772@ruby-lang.org

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/

  parent reply	other threads:[~2021-10-20 15:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 22:53 [ruby-core:99903] [Ruby master Bug#17146] Queue operations are allowed after it is frozen eregontp
2020-09-04  0:58 ` [ruby-core:99908] " ko1
2020-09-04  1:52 ` [ruby-core:99911] " merch-redmine
2020-09-04  3:56 ` [ruby-core:99913] " ko1
2020-09-13  9:25 ` [ruby-core:99999] " eregontp
2020-10-26 16:42 ` [ruby-core:100587] " ko1
2021-10-20 14:23 ` [ruby-core:105695] " Eregon (Benoit Daloze)
2021-10-20 14:44 ` [ruby-core:105698] " jeremyevans0 (Jeremy Evans)
2021-10-20 15:53 ` Eregon (Benoit Daloze) [this message]
2021-10-20 15:56 ` [ruby-core:105700] " Eregon (Benoit Daloze)
2021-10-20 16:17 ` [ruby-core:105702] " jeremyevans0 (Jeremy Evans)
2021-10-20 17:58 ` [ruby-core:105704] " Eregon (Benoit Daloze)
2021-10-20 20:32 ` [ruby-core:105705] " ioquatix (Samuel Williams)
2023-09-14  5:37 ` [ruby-core:114739] " matz (Yukihiro Matsumoto) via ruby-core
2023-09-14 13:36 ` [ruby-core:114751] " mame (Yusuke Endoh) via ruby-core
2023-09-27  0:21 ` [ruby-core:114900] " jeremyevans0 (Jeremy Evans) via ruby-core

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-94198.20211020155321.772@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).