From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Ifn+AuR0H2pl9zAAWB0awg (envelope-from ) for ; Tue, 02 Jun 2026 20:27:16 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=K5vMXIRA; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id F02DD1E024; Tue, 02 Jun 2026 20:27:15 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 247811E024 for ; Tue, 02 Jun 2026 20:27:15 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D8A7B4BA2E37 for ; Wed, 3 Jun 2026 00:27:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D8A7B4BA2E37 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=K5vMXIRA Received: from omta036.useast.a.cloudfilter.net (omta036.useast.a.cloudfilter.net [44.202.169.35]) by sourceware.org (Postfix) with ESMTPS id C2F534BA2E07 for ; Wed, 3 Jun 2026 00:26:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C2F534BA2E07 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C2F534BA2E07 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=44.202.169.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780446407; cv=none; b=qt4u82mkhzReDBWeMGIgcUrRG77UkJJyiCqcSRy5s8JiQJ5H1xP4TUFM1+qYO7sXlzGQHtl+XuL2y2hcaIUOxLBVhBX6G4pgsceNOe78JqSPHk7h3yjgmCe/Pw2/PFrGFBQrCgXMQaU/fhAIjYlidCQy3blIy2+5I+L9bdiPJl4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780446407; c=relaxed/simple; bh=pSjaBMaAMi+nKoGMCKo5UPSJQgm5/LNPR0NLKaB3BXs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=RFqPxCbh3iLVV7ObS7V7VhBYvqI+Oj/OjShBPumqLI2nilFHuq1TvP93+vezvdXyJbpeoAwG61mNa8iF+lCpOnaht/0fTY3VWX5/O/2ROjyoypf6vIeXe8IcnVF64WEuWmMgJ+eAsm1Os/OZo/TUKaVEnd/uphovxHwbKmNF/VM= ARC-Authentication-Results: i=1; sourceware.org; dkim=policy (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=K5vMXIRA reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C2F534BA2E07 Received: from eig-obgw-6002b.ext.cloudfilter.net ([10.0.30.203]) by cmsmtp with ESMTPS id USbbwYQFogwLnUZRXwSpWF; Wed, 03 Jun 2026 00:26:47 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id UZRWwwNZIfpvWUZRWw3ENU; Wed, 03 Jun 2026 00:26:47 +0000 X-Authority-Analysis: v=2.4 cv=Y6j4sgeN c=1 sm=1 tr=0 ts=6a1f74c7 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=FelO9ux0wxsA:10 a=ItBw4LHWJt0A:10 a=059fu53KkKn8TD94oqAA:9 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=zpnpNgb0gbbcjy5k8KFQCrFVzDLW6hCf7ZDQ5e8vinQ=; b=K5vMXIRAyyf6GsHVbAUDTpoAhj INZslSPmmhPtveNTwIYrRUqbIxgJ8nVxIfgORlLmi7/0+8LGBtBnUel1HuoBaWvufe9peurh7yhE2 6QGCQAHwGWmGvlk9BTDp51nwA; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:53992 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.99.2) (envelope-from ) id 1wUZRW-00000002xsB-1eNj; Tue, 02 Jun 2026 18:26:46 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Update use of deque in _frame_iterator Date: Tue, 2 Jun 2026 18:26:39 -0600 Message-ID: <20260603002639.3920962-1-tom@tromey.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.225.82 X-Source-L: No X-Exim-ID: 1wUZRW-00000002xsB-1eNj X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net (localhost.localdomain) [75.166.225.82]:53992 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfF0yscKvlgAvZAFV9AaYVxkha7BiywLrQdXpXCRdWiu0ajDtEEjc1JSY+VyI3lD1gZ1YONm7/cBIUNAXd8hvMZnPfR6AD6a4bEbf6umAOsoH+CsuORCs pknbbq/9z15Lp5bsON57Dq8p2omFxnRgyyGZrfAg3tZ+z5Swm8B0ywCAJFIEB6WEpOiVCL7jJ7lTvpRcIdb6peNYTOZq9KjJbAc= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org _frame_iterator has an old comment about some hand-written code that was needed when supporting Python 2.6. This patch simplifies the code by using a couple of features of collections.deque. --- gdb/python/lib/gdb/frames.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/gdb/python/lib/gdb/frames.py b/gdb/python/lib/gdb/frames.py index de954e4fb38..6539416b1c2 100644 --- a/gdb/python/lib/gdb/frames.py +++ b/gdb/python/lib/gdb/frames.py @@ -186,18 +186,7 @@ def _frame_iterator(frame, frame_low, frame_high, dap_semantics): # Is this a slice from the end of the backtrace, ie bt -2? if frame_low < 0: - count = 0 - slice_length = abs(frame_low) - # We cannot use MAXLEN argument for deque as it is 2.6 onwards - # and some GDB versions might be < 2.6. - sliced = collections.deque() - - for frame_item in frame_iterator: - if count >= slice_length: - sliced.popleft() - count = count + 1 - sliced.append(frame_item) - + sliced = collections.deque(iterable=frame_iterator, maxlen=abs(frame_low)) return iter(sliced) # -1 for frame_high means until the end of the backtrace. Set to -- 2.49.0