From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS24940 94.130.0.0/16 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_PASS,SPF_PASS shortcircuit=no 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 BD8831F698 for ; Thu, 29 Dec 2022 08:56:22 +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=hkShkrcU; 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=GHUhWqWj; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id C13EF7E7FB; Thu, 29 Dec 2022 08:56:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1672304175; bh=lPRgVD/7fV7Cu/CfKFsxXde21isyXl9CSyTAJjyIJXU=; 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=hkShkrcUsL0txuZjuE/HrW+EFR1tdagDd1eUYSVqHT+qzTXC2rp/5UasH32anuV9z gTPIAJN5JonhpvoVBswSw/8zSXag4W87gygwRd6K3S2n8NpPR/bI8KxPuckfL74r13 VxlVFfaLKljMDGnEur3segsGu/4MAnWVhvCUWaDo= Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 404277E7CF for ; Thu, 29 Dec 2022 08:56:11 +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=GHUhWqWj; 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=uLcUazVTnTCNMYZq4iZ8lJue609ZTljv9L3Bu7MviBo=; b=GHUhWqWj52vX5Mc5YLA1eNPqX1dMYck3OfHATLR5yZVva4L0O0KMIfD/ZSABHhiOXBsY YDTmbo45OXVx8AxZmwRxY2/RL75heZh0hmZjlNtdAXvPql5bis8vn2bhLQzSveLLbJGoCQ Cx3YxxF0RFAmdAhc4zedrRiYN483cS5zublp0PIuT2L+Y8kHAupzuqi3wM7hDm+owgRaZG WHl2pXVGoGgrPfmdS0wnMKXavMduxtOPd/KENP8SlkiivhgTkgLaqrHU4sTlFgRxXKU+Wx NjOJZPLeEPIURseRZ4+jThWPRRsil5VYynz56MEFGdouH4AI4AFbPDviD0G5Lj3Q== Received: by filterdrecv-557d69979-tbkgw with SMTP id filterdrecv-557d69979-tbkgw-1-63AD5629-A 2022-12-29 08:56:09.383599641 +0000 UTC m=+3577828.192858031 Received: from herokuapp.com (unknown) by geopod-ismtpd-1-2 (SG) with ESMTP id _nVrz6ZDRb-Eac9JcFzf9g for ; Thu, 29 Dec 2022 08:56:09.247 +0000 (UTC) Date: Thu, 29 Dec 2022 08:56:09 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 18743 X-Redmine-Issue-Author: sos4nt X-Redmine-Sender: marcper 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: 87896 X-SG-EID: =?us-ascii?Q?K75VH2vpOfoVyRxqri=2Fbc2AnHyPKhUg16ACPeXJfGEz39=2FTNvGpagDzNEi=2FKeC?= =?us-ascii?Q?r8dg8TetuvH53sI5+QoRllE1he5CBUy5I3e4uiK?= =?us-ascii?Q?JQaNzcWEqes8SAdYBIuwlVXZDSC6mvQBwlM6nqt?= =?us-ascii?Q?sc1IWrxEvPnUdbyKbvlO=2FGBtPQwtl8eJNbMOFPc?= =?us-ascii?Q?dkl+rcL5zNhqPBtoyi6=2FkevmuctkcQAw+AwPWT7?= =?us-ascii?Q?2HCftnlKUxUl7Zu2Lvr=2FAfsaL22iPBy3jeh=2FM0Y?= =?us-ascii?Q?immJd7vrrrSAkmNb0wEWw=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== Message-ID-Hash: 5NOJQQP6XBGRGVY3SQTPK2UIXYE3ZEU5 X-Message-ID-Hash: 5NOJQQP6XBGRGVY3SQTPK2UIXYE3ZEU5 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:111498] [Ruby master Bug#18743] Enumerator#next / peek re-use each others stacktraces List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "marcper (Marcelo Pereira) via ruby-core" Cc: "marcper (Marcelo Pereira)" Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Issue #18743 has been updated by marcper (Marcelo Pereira). Good evening, @matz. The PR with the bug fix is available now for a few mon= ths. Please advise on the next steps. ---------------------------------------- Bug #18743: Enumerator#next / peek re-use each others stacktraces https://bugs.ruby-lang.org/issues/18743#change-100867 * Author: sos4nt (Stefan Sch=FC=DFler) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- I encountered an odd behavior. If I rescue the `StopIteration` exception from `peek` and call `next` after= wards: (or vice-versa) ```ruby # enum.rb # 1 # 2 enum =3D [].each # 3 enum.peek rescue nil # 4 enum.next # 5 ``` it will show the stacktrace from the rescued `peek` call: ``` $ ruby enum.rb enum.rb:4:in `peek': iteration reached an end (StopIteration) from enum.rb:4:in `
' ``` Whereas the error should refer to `next` on line number 5. The same happens when calling `peek` after `next` or when having muliple `p= eek` / `next` calls: ```ruby # enum.rb # 1 # 2 enum =3D [].each # 3 enum.peek rescue nil # 4 enum.next rescue nil # 5 enum.peek rescue nil # 6 puts "line #{__LINE__}" # 7 enum.next # 8 ``` The stacktrace from the first (rescued) `peek` or `next` call will be shown= which doesn't reflect the actual error location: ``` $ ruby enum.rb line 7 enum.rb:4:in `peek': iteration reached an end (StopIteration) from enum.rb:4:in `
' ``` This is very confusing when debugging code. ---Files-------------------------------- 01-Recreate-stacktrace-enumerator.patch (1.29 KB) --=20 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-c= ore.ml.ruby-lang.org/