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.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 B330E1F44D for ; Tue, 13 Feb 2024 09:42:48 +0000 (UTC) Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id C70898296D; Tue, 13 Feb 2024 09:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1707817360; bh=ouj1vzO6q8GgRAVCqhToZbpXnH2j+qZ3T+zxGvDINB4=; 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=lTmyuEbGmpdXMsR7So3T/uGDhDTtffhfqoT0DS9BH6/oMuQiJcGaVGxWYmxYAQlr1 ZGtlk+P+o00oosm0A2IeJbACFUctBqdJX71wWKnGFxVD2sIxDXWug+kT8PlQaxzLNu yw3L57XSTFU0QBRnYlll/XrHRRmyzvWqJxRkf4UQ= Received: from wrqvtvtt.outbound-mail.sendgrid.net (wrqvtvtt.outbound-mail.sendgrid.net [149.72.120.119]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 1921F828EE for ; Tue, 13 Feb 2024 09:42:37 +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=C3B4dWXP; 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=nFftkVIPVEuWiWbObj4u6LoFSVRtG3XO116roxrACjw=; b=C3B4dWXPHJMez7QbJXb/3wSo43QxTMUwczMuiAyuKjHBlveDBk0mNn/WaByF+B+DDlyZ Bl4NhByJlwjK4xiVV0UgfSnMf0hytIR9xjzt0AcrS4tOvWcnvJcMbRPQR+NRU4Sml+qXv9 bQxAbS11AZeZXpb9upBzcRyA0owYKGmOiKxmMeanN3qR+JbBqhBPr9bbgD4Gz1UNT42cVN kV0CwVejeSLJ0gNcVJJ79ZkcStLnHmeJ6ViR7/eLufyI9vURUEYURZRR7I3jd7jRxR7Bic U5KTnmO+m1JYJqt8Xb/Ukr9C7y/wK3WUlvVkDDaXEmNhwDO11V/NmUZARq3ZxebQ== Received: by filterdrecv-5bbdbb56cd-l5dl4 with SMTP id filterdrecv-5bbdbb56cd-l5dl4-1-65CB398C-F 2024-02-13 09:42:36.710554822 +0000 UTC m=+393965.546744192 Received: from herokuapp.com (unknown) by geopod-ismtpd-36 (SG) with ESMTP id Yx5G-J24QW2bxhB2tL8S3g for ; Tue, 13 Feb 2024 09:42:36.687 +0000 (UTC) Date: Tue, 13 Feb 2024 09:42:36 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 19117 X-Redmine-Issue-Author: byroot X-Redmine-Sender: ko1 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: 93249 X-SG-EID: =?us-ascii?Q?YkmFGMrQnymZs=2F4gaHJnvrsFPAGAfVipS20r=2FEutHlZKBkOXJV3+2vYlfF3wrB?= =?us-ascii?Q?u+wzn1=2FYobjg0PO+JI9qcf5xfdzpFcvqyoPEvJX?= =?us-ascii?Q?ULfvOrZ6X0ov4=2FVBik7pWZDIDXA3h2X10yWmzif?= =?us-ascii?Q?4ttSEV8yzY8POdI0DsA+6mzeX7bPUS4oskbuYjE?= =?us-ascii?Q?=2F6T12+PXVCO5PTbQMpWZMesHwvfkWtNJuesUHGX?= =?us-ascii?Q?T7WVU4dUkuAE7WpJm5gpfWIbqYpjUIaJOSYEanB?= =?us-ascii?Q?bJu+eUcIsVeWuQ2fn5VkA=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== Message-ID-Hash: 6FA5JXH4F7A4ZNWGK37VM2EDOTS6KYML X-Message-ID-Hash: 6FA5JXH4F7A4ZNWGK37VM2EDOTS6KYML 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:116693] [Ruby master Feature#19117] Include the method owner in backtraces, not just the method name List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "ko1 (Koichi Sasada) via ruby-core" Cc: "ko1 (Koichi Sasada)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #19117 has been updated by ko1 (Koichi Sasada). Do we need quotes? >From comment #28 ``` ./test.rb:10:in `Integer#+': String can't be coerced into Integer (TypeError) from ./test.rb:10:in `block in Concrete.oops' from ./test.rb:3:in `Abstract#oops' from ./test.rb:16:in `block in Concrete#oops' from :90:in `Kernel#tap' from ./test.rb:15:in `Concrete#oops' from ./test.rb:10:in `Concrete.oops' from ./test.rb:21:in `Method#call' from ./test.rb:21:in `
' ``` vs ``` ./test.rb:10:in Integer#+: String can't be coerced into Integer (TypeError) from ./test.rb:10:in block in Concrete.oops from ./test.rb:3:in Abstract#oops from ./test.rb:16:in block in Concrete#oops from :90:in Kernel#tap from ./test.rb:15:in Concrete#oops from ./test.rb:10:in Concrete.oops from ./test.rb:21:in Method#call from ./test.rb:21:in
``` For example, python's case; ``` $ python3 Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> def foo(a): ... a + 10 ... >>> foo("str") Traceback (most recent call last): File "", line 1, in File "", line 2, in foo TypeError: can only concatenate str (not "int") to str ``` ---------------------------------------- Feature #19117: Include the method owner in backtraces, not just the method name https://bugs.ruby-lang.org/issues/19117#change-106705 * Author: byroot (Jean Boussier) * Status: Open * Priority: Normal * Target version: 3.4 ---------------------------------------- ``` module Foo class Bar def inspect 1 + '1' end end end p Foo::Bar.new ``` This code produce the following backtrace: ``` /tmp/foo.rb:4:in `+': String can't be coerced into Integer (TypeError) from /tmp/foo.rb:4:in `inspect' from /tmp/foo.rb:9:in `p' from /tmp/foo.rb:9:in `
' ``` This works, but on large codebases and large backtraces the method name isn't always all that revealing, most of the time you need to open many of the locations listed in the backtrace to really understand what is going on. I propose that we also include the owner name: ``` /tmp/foo.rb:4:in `Integer#+': String can't be coerced into Integer (TypeError) from /tmp/foo.rb:4:in `Foo::Bar#inspect' from /tmp/foo.rb:9:in `Kernel#p' from /tmp/foo.rb:9:in `
' ``` I believe that in many case it would allow to much better understand the backtrace without having to jump back and forth between it and the source code. This is inspired by @ivoanjo 's `backtracie` gem: https://github.com/ivoanjo/backtracie -- 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/