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 79ABC1F47A for ; Tue, 9 Jul 2024 06:46:16 +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=tbTR+uKf; 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=oYwkvPXh; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1720507543; bh=rc8XoQvhGjzwWpeFXahzsNulvI/gY6m27gTrwcGUOFI=; 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=tbTR+uKfWBXQQ1rfmAFq+tmoFXeCtx7GBdHf1yDrUTVS/LZWaM6nP5A5s6s/yvnuX 5C4oK3xxQO7zoU8qep8kpmH6clxDR8tm8gUQl8681KJSL/l3wEBuJjNS/YHY1vn2WG s/HtnUJ0xSZtt/edRaJLx6cjYlOLPN+4NxJB3A4c= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id E939E41460 for ; Tue, 9 Jul 2024 06:45:43 +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=oYwkvPXh; dkim-atps=neutral Received: from s.wrqvwxzv.outbound-mail.sendgrid.net (s.wrqvwxzv.outbound-mail.sendgrid.net [149.72.154.232]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 184CC41441 for ; Tue, 9 Jul 2024 06:45:32 +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=MGCGNkJmQ1P8ZwrISvhTckI6yna0YLYWLfA+RVEZ+SE=; b=oYwkvPXh/YYeiDCF7ffuEnMjnIngWQwOKWX9VRuDEGofMDw/hWR+iibJJEXrTSfZPG4A iQA5O2b5lTbzX0C+TJwFETcHK1xTFoc2vv7jhP+BDj2Ig4iPw6xXGZESzzwTlhsnlbT86Q XG7zFaW6aMhMZW3qatE/9dw/3a0/GtVsYgsR93jrdniIkvJ+U4HTJLg7wcu1oxMSevDBcn WuUzmD6LawD1y0RN+Bcf3ZcOdQNOSFhzjksRZNs6cEb9W0gR/tISpirR5RONozaOuEFMAA r9tHDw4hdDTd0LeAKhhYKVpmrtrMcJzC0/0OIQ+3hkrm7ue6JB0JO2hKDtiiAuSQ== Received: by recvd-946bcdf4b-66qhk with SMTP id recvd-946bcdf4b-66qhk-1-668CDC8B-1F 2024-07-09 06:45:31.624454416 +0000 UTC m=+999333.010015455 Received: from herokuapp.com (unknown) by geopod-ismtpd-34 (SG) with ESMTP id HNQ1mvl4THeOtjYpTO59XA for ; Tue, 09 Jul 2024 06:45:31.568 +0000 (UTC) Date: Tue, 09 Jul 2024 06:45:31 +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: 95147 X-SG-EID: =?us-ascii?Q?u001=2ELyyp8a6L4BPdoBZ5kcNQuEdalXgUnCKLcPykf2c9d2sTWfvALBzqM4Ij+?= =?us-ascii?Q?Jg9Prp2eVDkf9lIZhzc05KfUT4Npfgnigb95d+v?= =?us-ascii?Q?hGuAMoCQYcJ5=2FxBI8oxXR9z2=2FddO2p8wnPrsGpH?= =?us-ascii?Q?3YYJm5USKDOjgOjdjVZlLQBq=2F7+zd7bOAbCX0oM?= =?us-ascii?Q?gVTc1ndnnWZufYrRMq=2Fv7rwGce73loPNfxkdgFo?= =?us-ascii?Q?+SO8RZCG2Vq8yw=2FSXjZXXOyENcMm3jEVNk0SyIB?= =?us-ascii?Q?GJNdukWFbbjmnHPp+Wk=2FjeJhaQ=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: B7EADZGT2E4CZQ5W3B3VGOEQM657OACL X-Message-ID-Hash: B7EADZGT2E4CZQ5W3B3VGOEQM657OACL 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:118516] [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 don't think this is a bug. It does seem inconsistent, but only because the `all` argument to `singleton_methods` defaults to true. If you call `singleton_methods(false)`, then you get the behavior you would expect from the method name (only show actual singleton methods, not methods in modules that extend the object). ---------------------------------------- Bug #20620: singleton_method undefined for module using "extend self" https://bugs.ruby-lang.org/issues/20620#change-109037 * 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/