From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS,URIBL_SBL_A autolearn=ham autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 535E31F44D for ; Sat, 20 Apr 2024 11:04:47 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; secure) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=V6h22KS2; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=NgHoU6yS; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 9F563843C6; Sat, 20 Apr 2024 11:04:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1713611078; bh=m4cgmnovZ5gNg1CfiuDwBvKdmY/qS3zhXCBxXyXrqVU=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=V6h22KS2wS6NdSvucku2I1f5gXLAQpnOJVKHZUXChg7xPUa5WBFcz7iymoLpSw7hR ugGgAMQL7qs7zv3N8O8cyPGI9Yxe12kUVma25vdXdTmChaF1qiiIOz+dcDKzdSliHy FebPL3LLLk2kxCN9NPFkd0TWum+JPqZvne/2qAtk= Received: from s.wfbtzhsv.outbound-mail.sendgrid.net (s.wfbtzhsv.outbound-mail.sendgrid.net [159.183.224.104]) by nue.mailmanlists.eu (Postfix) with ESMTPS id A6D238432A for ; Sat, 20 Apr 2024 11:04:34 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=NgHoU6yS; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=0tYZa5h0cKLXPgqppHhU5n52fNZVj0hZ0rnliZE5aJk=; b=NgHoU6ySlbiHx6xYihXmzd5SbDS/8MFr1UP0Uj+odO5J5cRjIogr1Fpte8JbOk9cBr+L dLkIvF+H6ni2j5h/xy7cTkYQYKyOsrxWNyqFkRHkhe4OUywNfMsZ8/c95vzCtgl9a18AV9 KVmQE5rkfG3jKL8+juxhR6MXkSFL5VEuiRbNHX+VVBoEdO0Ee/QI3PFwZizJx6NmVxmmkZ dFrIoXlvcwqJqxzs6pc13vza3zXp1t8l2iPj+Le2lmFGuDNWmARnrxQPLTrjPenjJTc0UZ GXI2RzkJTq8Y/jbWy73FuZsDoc5U+BOstArruxMxFq1XykfWH3SJMrOQTSFpF9KQ== Received: by filterdrecv-854b845bd5-xlv9j with SMTP id filterdrecv-854b845bd5-xlv9j-1-6623A140-20 2024-04-20 11:04:32.669564171 +0000 UTC m=+652494.611359528 Received: from herokuapp.com (unknown) by geopod-ismtpd-1 (SG) with ESMTP id z_e0eyf5QxC_Kow2j0_54g for ; Sat, 20 Apr 2024 11:04:33.761 +0000 (UTC) Date: Sat, 20 Apr 2024 11:04:33 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20440 X-Redmine-Issue-Author: ozydingo X-Redmine-Issue-Priority: Normal X-Redmine-Sender: Eregon 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-Redmine-MailingListIntegration-Message-Ids: 94223 X-SG-EID: =?us-ascii?Q?u001=2EByjZWvxTCjdoV8K03xEuhE7KqN4thWULFLM7+oH78KY30oYB3qFthsDpL?= =?us-ascii?Q?4w4cbYa3ttBh8bAHPOnE=2FkzPba67JNu7Lnrked2?= =?us-ascii?Q?O7K9VQ=2FJax2UAhJrdXQc06JOCFS+J4D4S3JFmBY?= =?us-ascii?Q?dN5Wk1kpCapUjrpSmrlH7oNABCcwo4h8+rwM3Bt?= =?us-ascii?Q?48mZ83bGUyyZwvH6P3PdLJxvNlz9kyXpHyTs46X?= =?us-ascii?Q?mQM6G3ut0ixwLnAySvpfXEZenPGnSkS2pT1vzgH?= =?us-ascii?Q?1=2FrDdBcZ=2FHmLFlLKHBIxmAPqjg=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: XOB7V7AX7QTU5RJHJHESRUCOSZ6GKCB7 X-Message-ID-Hash: XOB7V7AX7QTU5RJHJHESRUCOSZ6GKCB7 X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:117627] [Ruby master Bug#20440] `super` from child class passing keyword arg as Hash if in a method with passthrough args called from base class List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "Eregon (Benoit Daloze) via ruby-core" Cc: "Eregon (Benoit Daloze)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20440 has been updated by Eregon (Benoit Daloze). See https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/ it also explains `(*, **)` and `(...)` which are better if you don't need compatibility with Ruby < 2.7. ---------------------------------------- Bug #20440: `super` from child class passing keyword arg as Hash if in a method with passthrough args called from base class https://bugs.ruby-lang.org/issues/20440#change-108034 * Author: ozydingo (Andrew Schwartz) * Status: Open * ruby -v: 3.3.0 * Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- Apologies for the verbose title, but that's the specific set of conditions that AFAICT are required to reproduce the bug! Here's the simplest setup I can reproduce: ```rb class Base def foo(*args, x: 1) puts "Base: calling foo with args: #{args}, x: #{x}" end def foo!(x: 1) puts "Base: calling foo! with x: #{x}" foo(x: x) end end class Child < Base def foo(*) puts "Child: calling foo" super end end ``` When I call `Child.new.foo!`, I expect it to call the base class method `foo!`, which will use the default keyword arg `x: 1`; then the child method `foo` with `x: 1`, and finally the base method `foo` with `x: 1`. However, this is not what I observe: ```rb Child.new.foo! Base: calling foo! with x: 1 Child: calling foo Base: calling foo with args: [{:x=>1}], x: 1 ``` So when the child `foo` method called `super`, it passed not only `x: 1` as a keyword arg, but *also* `{x: 1}` as a Hash positional arg to the super method. This is breaking my upgrade to Ruby 3.0 as I have a similar setup but without the `*args` param, this I am getting the error "wrong number of arguments (given 1, expected 0)". -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/