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-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham 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 DF9541F619 for ; Sun, 15 Mar 2020 21:24:37 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 18C3F120A0A; Mon, 16 Mar 2020 06:15:42 +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 6BE6B120A07 for ; Mon, 16 Mar 2020 06:15:40 +0900 (JST) Received: by filterdrecv-p3las1-7d96d95698-vz9kj with SMTP id filterdrecv-p3las1-7d96d95698-vz9kj-21-5E6E9B08-19 2020-03-15 21:15:52.409159964 +0000 UTC m=+333394.622056790 Received: from herokuapp.com (unknown [54.89.189.120]) by ismtpd0020p1iad2.sendgrid.net (SG) with ESMTP id sUYDVnw7RVCjLS7wwr-pTw for ; Sun, 15 Mar 2020 21:15:52.253 +0000 (UTC) Date: Sun, 15 Mar 2020 21:15:52 +0000 (UTC) From: merch-redmine@jeremyevans.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 73241 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: jeremyevans0 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?RVE3t853K5scBhbmJHUzZTFFeVC=2FZSUmHZ0Dc+26wcEi2CTgsF1oz0wTSSxGGN?= =?us-ascii?Q?BIn6jhjsFLtW7ulJO8vI3EyPz=2Frwhvf+U6TCIEb?= =?us-ascii?Q?+0ZhSjhPr3rVv08hWjSVu9pAqkhvdm=2Fz1DOlwyo?= =?us-ascii?Q?vp7SXIBx0MMWAALYgsz2X4Zi1ZytSoF8di1OAXc?= =?us-ascii?Q?i1sbdkLsT9yC=2FbljZDR51x30+rESnxQv5LMuPoV?= =?us-ascii?Q?9qnfA=2FPLX6wHeQ74s=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 97512 Subject: [ruby-core:97512] [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 jeremyevans0 (Jeremy Evans). Eregon (Benoit Daloze) wrote in #note-18: > @jeremyevans0 Could you take a look for the 2.7 backport? Sure, I'll take a look tomorrow and see if I can fix it locally and submit a pull request for the ruby_2_7 branch. ---------------------------------------- Bug #16519: pp [Hash.ruby2_keywords_hash({})] shows `[nil]` https://bugs.ruby-lang.org/issues/16519#change-84661 * 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: REQUIRED ---------------------------------------- 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/