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.6 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 722621F55B for ; Tue, 26 May 2020 09:45:37 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 4561A1209E2; Tue, 26 May 2020 18:45:08 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id 996B41209E1 for ; Tue, 26 May 2020 18:45:05 +0900 (JST) Received: by filterdrecv-p3mdw1-6dbfd75bfd-j7pnd with SMTP id filterdrecv-p3mdw1-6dbfd75bfd-j7pnd-17-5ECCE534-35 2020-05-26 09:45:24.349430435 +0000 UTC m=+5301476.566800090 Received: from herokuapp.com (unknown) by ismtpd0046p1iad1.sendgrid.net (SG) with ESMTP id -GFiev-yTKGA008PWROgFQ for ; Tue, 26 May 2020 09:45:24.277 +0000 (UTC) Date: Tue, 26 May 2020 09:45:24 +0000 (UTC) From: beaurain.florent@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 74315 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 16914 X-Redmine-Issue-Author: beauraF X-Redmine-Sender: beauraF 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?0YtqsiEXdBJjaFLdaJiNkUML8ccsvqdszTW44odb3zxV9m2gdTjxKF2VFaRvTu?= =?us-ascii?Q?vqVUBXnGoR=2FJWh2puwOQE2sOJkqgdHdRSjRQ36d?= =?us-ascii?Q?HWhPTWjOWOpIksr1sueLP55n72THasMEaLOayuz?= =?us-ascii?Q?yC1GXAcXeSm1qekpkrswtnUDSfgPUwrjdFEQWgq?= =?us-ascii?Q?XTr+HS3EotlT8gtKUS9HQ9f5SXp3Ur5l1oRfBtM?= =?us-ascii?Q?jAE2uQwWELPtMH9nE=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 98523 Subject: [ruby-core:98523] [Ruby master Bug#16914] Hash.new with a block returns a proc 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 reported by beauraF (Florent Beaurain). ---------------------------------------- Bug #16914: Hash.new with a block returns a proc sometimes https://bugs.ruby-lang.org/issues/16914 * Author: beauraF (Florent Beaurain) * Status: Open * Priority: Normal * ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-darwin19] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN ---------------------------------------- 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/