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 DF0591F5AE for ; Thu, 23 Jul 2020 08:02:26 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 8ED8E120B45; Thu, 23 Jul 2020 17:01:56 +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 DD2CC120B44 for ; Thu, 23 Jul 2020 17:01:54 +0900 (JST) Received: by filterdrecv-p3iad2-5b55dcd864-xvj6x with SMTP id filterdrecv-p3iad2-5b55dcd864-xvj6x-20-5F19440D-1C6 2020-07-23 08:02:21.914989971 +0000 UTC m=+2299986.022627013 Received: from herokuapp.com (unknown) by ismtpd0001p1iad1.sendgrid.net (SG) with ESMTP id mB14QbGhRJC8R7LoPx1wCA for ; Thu, 23 Jul 2020 08:02:21.762 +0000 (UTC) Date: Thu, 23 Jul 2020 08:02:21 +0000 (UTC) From: nagachika00@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 75082 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 16519 X-Redmine-Issue-Author: Eregon X-Redmine-Issue-Assignee: jeremyevans0 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=2FBweHq94VtySnz3K9xScY?= =?us-ascii?Q?oiKJjMjMY8ByVa3iPRhA8qzXE1mWr3z4d1=2Fu=2Fyg?= =?us-ascii?Q?e9fizvdQbCwg18LWFlSmG1v+Ctqv67Vq9jJ53+H?= =?us-ascii?Q?Pw1q2tD=2FPO9hQsYWJVxNaLbw4bjhvAy+VHwS4XQ?= =?us-ascii?Q?AohUnV=2FPzTcycF7rZ3059OKTQMPpFYZ+vuspnVc?= =?us-ascii?Q?deTkcd=2Fko+REWdvNg=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 99293 Subject: [ruby-core:99293] [Ruby master Bug#16519] pp [Hash.ruby2_keywords_hash({})] shows `[nil]` 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 #16519 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: REQUIRED to 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: DONE Seems already backported at bb93659fefd7f4557129043742771a33bd30c255. ---------------------------------------- Bug #16519: pp [Hash.ruby2_keywords_hash({})] shows `[nil]` https://bugs.ruby-lang.org/issues/16519#change-86682 * Author: Eregon (Benoit Daloze) * Status: Closed * Priority: Normal * Assignee: jeremyevans0 (Jeremy Evans) * ruby -v: ruby 2.8.0dev (2020-01-21T13:45:10Z master 5798d35ff6) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: DONE ---------------------------------------- This happens on `master`: ``` $ ruby -ve 'ruby2_keywords def flag(*a); a.last; end; pp [flag(**{})]' ruby 2.8.0dev (2020-01-21T13:45:10Z master 5798d35ff6) [x86_64-linux] [nil] ``` Of course it should be `[{}]`, as it is for `pp [{}]`. On 2.7.0 it warns (should be fixed, it's valid to `pp` a flagged Hash): ``` $ ruby -ve 'ruby2_keywords def flag(*a); a.last; end; pp [flag(**{})]' ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux] [/home/eregon/.rubies/ruby-2.7.0/lib/ruby/2.7.0/pp.rb:226: warning: Passing the keyword argument as the last hash parameter is deprecated /home/eregon/.rubies/ruby-2.7.0/lib/ruby/2.7.0/pp.rb:334: warning: The called method is defined here {}] ``` The warning being in the middle of the output is a fun fact here. Lines it refers to (still the same on current master): https://github.com/ruby/ruby/blob/v2_7_0/lib/pp.rb#L226 https://github.com/ruby/ruby/blob/v2_7_0/lib/pp.rb#L334 This is very confusing as it can happen during `test-all` and then show output such as: ``` <[{:a=>1}]> expected but was <[{:a=>1}, nil]>. ``` when the reality is (can be verified with `p` before the `assert_equal`): ``` <[{:a=>1}]> expected but was <[{:a=>1}, {}]>. ``` -- https://bugs.ruby-lang.org/