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: X-Spam-Status: No, score=-3.6 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS, URIBL_GREY shortcircuit=no autolearn=ham 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 1CD921F47D for ; Thu, 9 Mar 2023 06:26:28 +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=bVLBI7WO; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sendgrid.net header.i=@sendgrid.net header.a=rsa-sha256 header.s=smtpapi header.b=mvRzihXD; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 6667B7F320; Thu, 9 Mar 2023 06:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1678343180; bh=FOxaSK8/XgG15GOxQ6uKx9EPPOytEI8qeamj/35aXhU=; 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=bVLBI7WOr02b8D3iMWJ9tGK+X0uQJT+qYuBy+uDqVVSw/dYf3OU63r9XIhStqsU4x FXN3awXJ3wF80QkIm5adD79pfhbT8sd/whJ67IjTwehvO8EE0Nttk2pdRSjPJ1n0td fkSZI4RxM1miKxd1M2ZsnhWovdZUGG95FLKjWtAI= Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 9FB897F31C for ; Thu, 9 Mar 2023 06:26:16 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (1024-bit key; unprotected) header.d=sendgrid.net header.i=@sendgrid.net header.a=rsa-sha256 header.s=smtpapi header.b=mvRzihXD; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendgrid.net; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=smtpapi; bh=bXsrMN7PDX7guqe7LOSiv1gqeOVKTd9QFI5IyHKZVsc=; b=mvRzihXDVLJDXuRVEnNAmyo6oZhQE2AudhjKjAqjmmAV2Ij+heQoz/9f5N9yvwSsG5BA GoJMTTIHTw212l1jP5/5cVcfRc49wJDiFp5XxcCsW6Uo/lIThEAsdIrkbOUAlZIiRpEWdn fCzcz7Amd9vG3eKT5FYCUuQ5hf0H18Cpc= Received: by filterdrecv-59cb65cf6d-7cbts with SMTP id filterdrecv-59cb65cf6d-7cbts-1-64097C06-18 2023-03-09 06:26:14.809753279 +0000 UTC m=+1320887.330417074 Received: from herokuapp.com (unknown) by geopod-ismtpd-27 (SG) with ESMTP id AtilTfKEQaaZYkfD3GYWNg for ; Thu, 09 Mar 2023 06:26:14.749 +0000 (UTC) Date: Thu, 09 Mar 2023 06:26:14 +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-Issue-Assignee: ko1 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: 89177 X-SG-EID: =?us-ascii?Q?YkmFGMrQnymZs=2F4gaHJnvrsFPAGAfVipS20r=2FEutHlb=2FZYnS3bF=2F6ZEwsXF+cM?= =?us-ascii?Q?g1XAO5pLP8XOsMWVzzDAJay6r2xGJZ6QlkIxrWe?= =?us-ascii?Q?NcYO8sVfwfjN5hX6mAngvcEwj68VlWSElbn9IiQ?= =?us-ascii?Q?Ss=2FwJPxzDTd6QwrMyUizWID4Y8ceLJg0hZcxt7d?= =?us-ascii?Q?=2FI0ZKzrSGQCByNDCWm7Ti9zT=2F83ISDZj5pEH8l7?= =?us-ascii?Q?5NDOiHDfCPYrzwwBJqT13d1Hc5sbONI9Aai8U+6?= =?us-ascii?Q?PQFBAEoFwaf1dcdAvoztA=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== Message-ID-Hash: XFG6FJ3SACEXCAGK57LMA3SCEPWL66PE X-Message-ID-Hash: XFG6FJ3SACEXCAGK57LMA3SCEPWL66PE X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@sendgrid.net 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:112763] [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: "ko1 (Koichi Sasada) via ruby-core" Cc: "ko1 (Koichi Sasada)" Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Issue #18743 has been updated by ko1 (Koichi Sasada). Assignee set to ko1 (Koichi Sasada) ---------------------------------------- Bug #18743: Enumerator#next / peek re-use each others stacktraces https://bugs.ruby-lang.org/issues/18743#change-102258 * Author: sos4nt (Stefan Sch=FC=DFler) * Status: Open * Priority: Normal * Assignee: ko1 (Koichi Sasada) * 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/