From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id D45491F5AE for ; Sun, 26 Jul 2020 09:32:58 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 82FD6120A2F; Sun, 26 Jul 2020 18:32:28 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id E8F7E120A2B for ; Sun, 26 Jul 2020 18:32:25 +0900 (JST) Received: by filterdrecv-p3las1-7754f7d4cc-fqrzr with SMTP id filterdrecv-p3las1-7754f7d4cc-fqrzr-19-5F1D4DC3-3A 2020-07-26 09:32:51.849114265 +0000 UTC m=+2647159.014106340 Received: from herokuapp.com (unknown) by ismtpd0001p1iad1.sendgrid.net (SG) with ESMTP id XhXo9nkRR1i0hR_CmWqq7g for ; Sun, 26 Jul 2020 09:32:51.720 +0000 (UTC) Date: Sun, 26 Jul 2020 09:32:51 +0000 (UTC) From: nagachika00@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 75139 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 16914 X-Redmine-Issue-Author: beauraF X-Redmine-Sender: nagachika X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?O2wxg26uOO6cft6GjkEp=2FGevTnH9lR=2FEdG60AX3F8=2FD=2FtutYmdTHsp0WpMEaIK?= =?us-ascii?Q?yIBeVoL0pwN7Ow6xpSQN+=2FdrzHXIPD8OyUEFVDC?= =?us-ascii?Q?u9pZVPVRps8Fh8hyQyIb4lb31XIWS4dyXO9tHfi?= =?us-ascii?Q?DzYTF04ttuOXVgcUx2eI8HGC3XunEkG+qYQvzhf?= =?us-ascii?Q?vBXGZrbbVpJaZBMhOgXy3O8gDt1HwF5EvjHz1Pl?= =?us-ascii?Q?dMKUV84KK6bXtjSeI=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 99347 Subject: [ruby-core:99347] [Ruby master Bug#16914] Hash.new with `default_proc` returns this `default_proc` instead of calling it sometimes X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #16914 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED to 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONE ruby_2_7 05c4c88767b54808cd1459a1d6da11179c422cfa merged revision(s) 1b4d406e3a04032b6d01e92b6d184a16945c6ac3. ---------------------------------------- Bug #16914: Hash.new with `default_proc` returns this `default_proc` instead of calling it sometimes https://bugs.ruby-lang.org/issues/16914#change-86741 * Author: beauraF (Florent Beaurain) * Status: Closed * Priority: Normal * ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19] * Backport: 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONE ---------------------------------------- Hello, First of all, I want to apologize because this bug report will not be realized at all in good shape. I encounter this problem on a rails application currently in production, but I am unable to reproduce it. I failed to provide you a script to reproduce. I'm very sorry. But.. maybe it will ring a bell to someone. --- So, I have a hash, built this way: ```ruby messages .each_with_object(Hash.new { [] }) { ... } .transform_values { ... } { [:appointment, {:import_identifier=>"TVER111111114^ORBIS"}]=>#, [:appointment, {:import_identifier=>"TVER111111115^ORBIS"}]=>#, [:appointment, {:import_identifier=>"TVER111111116^ORBIS"}]=>#, [:appointment, {:id=>"30"}]=>#, [:appointment, {:import_identifier=>"TVER111111111^ORBIS"}]=>#, [:appointment, {:import_identifier=>"TVER111111112^ORBIS"}]=>#, } ``` Here is the result in `ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]` when I try to access it: ```ruby hash[[:appointment, {:import_identifier=>"TVER111111114^ORBIS"}]] => # hash[[:appointment, {:import_identifier=>"TVER111111117^ORBIS"}]] => nil ``` Here is the result in `ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19]` when I try to access it: ```ruby hash[[:appointment, {:import_identifier=>"TVER111111114^ORBIS"}]] => # hash[[:appointment, {:import_identifier=>"TVER111111117^ORBIS"}]] => # hash[[:appointment, {:import_identifier=>"TVER111111117^ORBIS"}]].call => [] ``` note: `retry_inbound_messages.rb:75` => `.each_with_object(Hash.new { [] }) { ... }` --- So, if I'm right, the result on ruby 2.6, was not the good one but acceptable one on my side. On ruby 2.7, we're close to the good result, but we have to call the proc manually, which causes a lot of worries on my side. At your entire disposal, if I can help in any way. -- https://bugs.ruby-lang.org/