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 [IPv6:2a01:4f8:1c0c:6b10::1]) (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 750A41F44D for ; Thu, 21 Mar 2024 20:09:04 +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=zDcrYCSz; 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=SRbMjjO5; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id B038783688; Thu, 21 Mar 2024 20:08:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1711051737; bh=YX6gXR8Qu6pwRoWuP+AtjVg07KfRbDIE8RXXSFHH9Lc=; 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=zDcrYCSzKY8udWCQdoviADOjq/SkWq/p1WnGsakqT/368O4Hi3j1+VT8Vljp1sO3E Y0ZZ70MGlIzPr/vZdN3QIKQpWo5PbPIn8wWhw5aRmMj6Dnc3w9Bmwy1qfcQ+XebKXC Ymkt9F3hpzSzN71LVRZtuYGSBe//BsuRTu1dVaG0= 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 917E9834EE for ; Thu, 21 Mar 2024 20:08:54 +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=SRbMjjO5; 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=B4+IDRQsbVDWHMgM1phMj7sWiO22xjsmdfoG8eD4vlc=; b=SRbMjjO5tefxOjc/nXLqW5tLBZz8HmMjnkv9ZQUGPrBzSXx8HYp2jK6oQFBVjefnn6DF k1u6yKe1vsdh0yTzBHtmaIkEkpNqVBmfKNyxINduLr4Fq4KsJ7PzV4EXa9V5bftO7eCVk2 AO64dVE8eAsRt8Y175YoadO2ORCTugSm1gu42KJh7xd10ogRU6R3XhaChDLXB/axiziIf7 ArchAcr1GUyM1R+U5pFD5rHEeDBGJEmLTI73JC8ccBwPOUsCVl1KT7seT0eq0hrC+CWT6r QYRI9M65RHhi5fRq2WjQsXECnDp9TNVIne4Gp5Hju6rp3IkdnaDhWo6ERSSh+WCA== Received: by recvd-7fc89fc779-btzsr with SMTP id recvd-7fc89fc779-btzsr-1-65FC93D5-10 2024-03-21 20:08:53.471156477 +0000 UTC m=+256135.555482406 Received: from herokuapp.com (unknown) by geopod-ismtpd-35 (SG) with ESMTP id CZwDFkW9QKWKzYYnliTHag for ; Thu, 21 Mar 2024 20:08:53.416 +0000 (UTC) Date: Thu, 21 Mar 2024 20:08:53 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 20275 X-Redmine-Issue-Author: Eregon X-Redmine-Issue-Assignee: Eregon 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: 93886 X-SG-EID: =?us-ascii?Q?u001=2EByjZWvxTCjdoV8K03xEuhE7KqN4thWULFLM7+oH78KY30oYB3qFthsDpL?= =?us-ascii?Q?4w4cbYa3ttBh8bAHPOnE=2FkzPba67JNu7Lnrked2?= =?us-ascii?Q?O7K9VQ=2FJax3Rm0iGdbGTrSbN5uTLG6KtY71Uswr?= =?us-ascii?Q?sNLeGB2ZpfpwBG1wVZm=2FwrJCOvuGQZEnEfgUzD=2F?= =?us-ascii?Q?UAg3ag5sdLnFB5R3N60ONbnfh6sGcXL+SFjksst?= =?us-ascii?Q?EP9n864MEPIKzhV6B3qyiUX757kKH0zkqtatR2W?= =?us-ascii?Q?0ahKYLTbwwjjdfaETJH+HIGwxg=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: C7T7VTWKHWVGM54L3IZJQXSFLUBOOEW2 X-Message-ID-Hash: C7T7VTWKHWVGM54L3IZJQXSFLUBOOEW2 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:117287] [Ruby master Feature#20275] Avoid extra backtrace entries for rescue and ensure 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 #20275 has been updated by Eregon (Benoit Daloze). Assignee changed from matz (Yukihiro Matsumoto) to Eregon (Benoit Daloze) PR: https://github.com/ruby/ruby/pull/10325 ---------------------------------------- Feature #20275: Avoid extra backtrace entries for rescue and ensure https://bugs.ruby-lang.org/issues/20275#change-107413 * Author: Eregon (Benoit Daloze) * Status: Open * Assignee: Eregon (Benoit Daloze) ---------------------------------------- >From https://bugs.ruby-lang.org/issues/19117#note-48: ```ruby def raise_nested_exceptions raise "First error" rescue begin raise "Second error" rescue raise "Third error" end end raise_nested_exceptions ``` Current: ``` -:7:in 'Object#raise_nested_exceptions': Third error (RuntimeError) from -:4:in 'Object#raise_nested_exceptions' from -:1:in 'Object#raise_nested_exceptions' from -:11:in '
' -:5:in 'Object#raise_nested_exceptions': Second error (RuntimeError) from -:1:in 'Object#raise_nested_exceptions' from -:11:in '
' -:2:in 'Object#raise_nested_exceptions': First error (RuntimeError) from -:11:in '
' ``` The above repeated backtrace entries for `Object#raise_nested_exceptions` are because of CRuby implementation details. It seems best to hide them because they do not help understanding the program, and semantically there is no (method or proc) call on line 1 or 4. Proposed: ``` -:7:in 'Object#raise_nested_exceptions': Third error (RuntimeError) from -:11:in '
' -:5:in 'Object#raise_nested_exceptions': Second error (RuntimeError) from -:11:in '
' -:2:in 'Object#raise_nested_exceptions': First error (RuntimeError) from -:11:in '
' ``` We can see TruffleRuby and JRuby already behave this way, most likely because they do not use an extra frame for `rescue`. It is definitely useful to have the same backtrace on different Ruby implementations as some tests rely on this. TruffleRuby 23.1.2: ``` -:7:in `raise_nested_exceptions': Third error (RuntimeError) from -:11:in `
' -:5:in `raise_nested_exceptions': Second error (RuntimeError) from -:11:in `
' -:2:in `raise_nested_exceptions': First error (RuntimeError) from -:11:in `
' ``` JRuby 9.4.5.0: ``` RuntimeError: Third error raise_nested_exceptions at -:7
at -:11 RuntimeError: Second error raise_nested_exceptions at -:5
at -:11 RuntimeError: First error raise_nested_exceptions at -:2
at -:11 ``` -- 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/