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)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 0DD2D1F4BE for ; Mon, 21 Oct 2024 16:46:27 +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=FT6TTIMF; 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=qELfWHXc; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1729529155; bh=LDc/E5kRtHuomY/YxcO1edA/oneSlEwXxMEDqHZYK1Q=; 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=FT6TTIMFLJtLCjxPkspjVOssJOa4rDg1pcIz9oO5/jZ6qiAyIXL6CnZsSEyowzH++ yZlxghz+morUQJ384ub/NTy3qd31ia+WrkSnR3XJlUaAGte/IVHTZXDKhczkTerL5p NeWgIG9Xw2jn/c6IW4etl3X2IQb+zIhHS9OshGcU= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id B5C85445BD for ; Mon, 21 Oct 2024 16:45:55 +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=qELfWHXc; 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 BAEAF44550 for ; Mon, 21 Oct 2024 16:45:43 +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=XhTxUwAUhkTl0uG2+0HOoooaK1/TqR55VzWmHBQWAB4=; b=qELfWHXcu7s9PHk+2ROn76T6wyGDdbEM8qw6tKsYxQwZ8YWmUmZUSco854txmGDK8+z/ WyrikVTwxUlydDYLzFIlq99x03QdDH7yeVxclDz8zlfcg+leDJigmFcXzYGNl1Iea9dXya /TNc5JXptB1k4Ug3vFzgN6FgVbw2zXVGU6G0rCfPfIF4GwqIJeILwp9IsoLuE6aWRQ1tJ5 TLTd224rqKteKAZ/FNl2YPeB09onIaiALSPDJO0XBJ5QM1Ni3k1fpkpqw+VBYu8Iv4SEGT f4Np2ZFcnZ1TaKLwZYkE2ut+p0beYdszmGKRO0ShdmTI/Lc+AboKc5dJF7CTXwPQ== Received: by recvd-d66cff667-5gwwj with SMTP id recvd-d66cff667-5gwwj-1-67168536-26 2024-10-21 16:45:42.312015815 +0000 UTC m=+3365268.013361331 Received: from herokuapp.com (unknown) by geopod-ismtpd-21 (SG) with ESMTP id SnX5G_crQTW66L8sdC_n1g for ; Mon, 21 Oct 2024 16:45:42.169 +0000 (UTC) Date: Mon, 21 Oct 2024 16:45:42 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 20808 X-Redmine-Issue-Author: maicolben X-Redmine-Issue-Priority: Normal X-Redmine-Sender: byroot 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: 96211 X-SG-EID: =?us-ascii?Q?u001=2EKmNZ1u3n1vIpO8NNTdp+Q9c0ai7potxbEDLMO7SOJO=2F4KkRUz0d23466m?= =?us-ascii?Q?naiq=2F5fmA4hb60MdRMUAwHZnjIWVFu=2FrqiBOz5c?= =?us-ascii?Q?nOvkBudsSTgvh760l=2F+Pod3ugMHyImfnmRo1zyP?= =?us-ascii?Q?hqXIDiEEGy6SQ1bkriFDpNSe+Mo4=2FAP0LEDeSu+?= =?us-ascii?Q?ou+6599cNFPjKERVv=2F0pTJATAdvTDU0oF4IDowv?= =?us-ascii?Q?gcBEQmg1mORk8yYiYD4YTbgZc+pHcCad3iVxjEF?= =?us-ascii?Q?pZ82Pr7IvPpCe2Z8=2Fb4fkpE2UQ=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: I3S6FVOE5RDXXTOPGP3BAHDNXS6TZMRD X-Message-ID-Hash: I3S6FVOE5RDXXTOPGP3BAHDNXS6TZMRD 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:119577] [Ruby master Bug#20808] Cannot override Data#inspect List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "byroot (Jean Boussier) via ruby-core" Cc: "byroot (Jean Boussier)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20808 has been updated by byroot (Jean Boussier). The `pp` implementation for `Struct` and `Data` both assume all member readers are public: ```ruby class Struct # :nodoc: def pretty_print(q) # :nodoc: q.group(1, sprintf("#') { q.seplist(PP.mcall(self, Struct, :members), lambda { q.text "," }) {|member| q.breakable q.text member.to_s q.text '=' q.group(1) { q.breakable '' q.pp self[member] } } } end def pretty_print_cycle(q) # :nodoc: q.text sprintf("#", PP.mcall(self, Kernel, :class).name) end end class Data # :nodoc: def pretty_print(q) # :nodoc: q.group(1, sprintf("#') { q.seplist(PP.mcall(self, Data, :members), lambda { q.text "," }) {|member| q.breakable q.text member.to_s q.text '=' q.group(1) { q.breakable '' q.pp public_send(member) } } } end def pretty_print_cycle(q) # :nodoc: q.text sprintf("#", PP.mcall(self, Kernel, :class).name) end end if "3.2" <= RUBY_VERSION ``` ---------------------------------------- Bug #20808: Cannot override Data#inspect https://bugs.ruby-lang.org/issues/20808#change-110196 * Author: maicolben (Maicol Bentancor) * Status: Open * ruby -v: 3.3.5 * Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN ---------------------------------------- Given the next code: ``` Dog = Data.define(:name) do def inspect "Hello!" end private attr_reader :name end Dog.new(name: "Fido") ``` It throws an error: - An error occurred when inspecting the object: # And isn't using my `inspect` function -- 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/