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=0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS autolearn=no 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 CA4C11F5C9 for ; Thu, 12 Sep 2024 14:24:30 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=uipxPquj; 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=cnZA06ZB; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1726151038; bh=T8DCZnwrq2TBXEm3FbhKnhe4whmXWvJUnikLC9exvfg=; 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=uipxPqujs3lzV5B5pHhS8g/zorJkjTbiHTig6JqFxA214ltCbF2DHwHt2oVVEFXh7 w9XLqEFmpnarHBp26JzOWOVX1adFzDyAaSFSmjgJsYvS6aOjgbVYzV+rBrTKqg51OY wWEQXCpTjPUgYxwgL/86zhHk9LfTxAm5OmrSPPeI= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 1395443DAC for ; Thu, 12 Sep 2024 14:23:58 +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=cnZA06ZB; dkim-atps=neutral Received: from s.wrqvtzvf.outbound-mail.sendgrid.net (s.wrqvtzvf.outbound-mail.sendgrid.net [149.72.126.143]) by nue.mailmanlists.eu (Postfix) with ESMTPS id D4FE243D6B for ; Thu, 12 Sep 2024 14:23:46 +0000 (UTC) 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=6DzbP0v6/H5dvIz+gxRjlj06j0KPLkcjGFbmVbEf0q0=; b=cnZA06ZBdp8+1I7NJHX9KJYg2wjRKlqyw/X7qJd1xrJwnV/VpWKLlvJUT4MohgIbJyMe 6BVgkodsIeHjux3wVsbz0du5jVigkLRt3FIUIKOzyBY61ojVsnhRsEgW/xEz1bQ1sghqnM znocN//yFuGh2fFxC0eRYqhRJzivjDCOxcbSc+wPCY+d49PdKXBfunzR6pnr69jnJQ8cnS z634fPFgMxmHRtBj3qFRf8mfl0j4t5YQ4ChYqtFriP1JgbsMReNOSmRb2bBo+z86jUUuMh w7l8W8KgxnvJLKFioROpfL0YOE2l6w8vL03cNgbm30ptbetL8EVoGseuq4/AxUxA== Received: by recvd-764b8dc56-hdnnb with SMTP id recvd-764b8dc56-hdnnb-1-66E2F971-16 2024-09-12 14:23:45.4238385 +0000 UTC m=+1872164.451891767 Received: from herokuapp.com (unknown) by geopod-ismtpd-39 (SG) with ESMTP id oBeKF5luRlGZZMZHfRz3-A for ; Thu, 12 Sep 2024 14:23:45.374 +0000 (UTC) Date: Thu, 12 Sep 2024 14:23:37 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20620 X-Redmine-Issue-Author: dentarg X-Redmine-Issue-Priority: Normal 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-Redmine-MailingListIntegration-Message-Ids: 95773 X-SG-EID: =?us-ascii?Q?u001=2ELyyp8a6L4BPdoBZ5kcNQuEdalXgUnCKLcPykf2c9d2sTWfvALBzqM4Ij+?= =?us-ascii?Q?Jg9Prp2eVDkf9lIZhzc05KfUT4Npfgnigb95d+v?= =?us-ascii?Q?hGuAMoCQYcKS9dWhQ7DAotxQ3QvTOcc+CyAWVk+?= =?us-ascii?Q?0=2FdDXvY2foReejqjcMhoGdvnbvghtygFwC3y9Cw?= =?us-ascii?Q?A4Wqz9psnSCpb52g+OczZcnn1PXi7SrQuwwB1=2FV?= =?us-ascii?Q?SbqP6VQpi25zGdtrwCKpgixXMtvB+32L0HHp0Fy?= =?us-ascii?Q?0qzuU5f5fb8mXIdk9=2FC3anoT9w=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: AMMHUYTJOQCCW5OJGHC7OH4BPVM37LPN X-Message-ID-Hash: AMMHUYTJOQCCW5OJGHC7OH4BPVM37LPN 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.9 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:119138] [Ruby master Bug#20620] singleton_method undefined for module using "extend self" List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "jeremyevans0 (Jeremy Evans) via ruby-core" Cc: "jeremyevans0 (Jeremy Evans)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20620 has been updated by jeremyevans0 (Jeremy Evans). I submitted a pull request to implement this: https://github.com/ruby/ruby/pull/11605 In terms of compatibility issues: * For singleton classes that prepend a module, and have the method defined in both the singleton class and prepended module, `singleton_method` now returns the method in the prepended module. * Cases where a method is defined in a module prepended to or included in the singleton classes and not in the singleton class itself now result in a `Method` Object being returned, instead of raising `NameError`. Use of `singleton_method` isn't that common in my experience, so I think we should make the change. There is still time to back it out of 3.4 if it causes issues. ---------------------------------------- Bug #20620: singleton_method undefined for module using "extend self" https://bugs.ruby-lang.org/issues/20620#change-109727 * Author: dentarg (Patrik Ragnarsson) * Status: Open * ruby -v: ruby 3.4.0dev (2024-07-08T21:43:28Z master e500222de1) [x86_64-linux] * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- Is this a bug? I expected `ExtendSelf.singleton_method(:foo)` to work when `ExtendSelf.singleton_methods` worked and `:foo` was in the list returned. ```ruby # singleton_method.rb class Klass def self.foo end end module ExtendSelf extend self def foo end end p RUBY_DESCRIPTION p "Klass" p Klass.singleton_methods # => [:foo] p Klass.singleton_method(:foo) # => # p "ExtendSelf" p ExtendSelf.singleton_methods # => [:foo] p ExtendSelf.singleton_method(:foo) # => singleton_method.rb:19:in `singleton_method': undefined singleton method `foo' for `ExtendSelf' (NameError) ``` ```shell $ docker run --rm -it -v $(pwd):/app -w /app rubylang/ruby:master-nightly-jammy Unable to find image 'rubylang/ruby:master-nightly-jammy' locally master-nightly-jammy: Pulling from rubylang/ruby ... Digest: sha256:922037b184b897786a26b2460f70a66139f87dce67f20ddf760cd4186790ed9f root@9807305c322a:/app# ruby -v ruby 3.4.0dev (2024-07-08T21:43:28Z master e500222de1) [x86_64-linux] root@9807305c322a:/app# ruby singleton_method.rb "ruby 3.4.0dev (2024-07-08T21:43:28Z master e500222de1) [x86_64-linux]" "Klass" [:foo] # "ExtendSelf" [:foo] singleton_method.rb:21:in 'Kernel#singleton_method': undefined singleton method 'foo' for 'ExtendSelf' (NameError) ``` -- 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/lists/ruby-core.ml.ruby-lang.org/