From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2127) id AE99B3858407; Thu, 4 Aug 2022 11:21:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AE99B3858407 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Ulrich Drepper To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-1956] Adjust index number of tuple pretty printer X-Act-Checkin: gcc X-Git-Author: Ulrich Drepper X-Git-Refname: refs/heads/master X-Git-Oldrev: 2f17f489de47d46626ed85804c3b810547ef550e X-Git-Newrev: 075683767abe15b936ad41792da6ee71e9eda449 Message-Id: <20220804112103.AE99B3858407@sourceware.org> Date: Thu, 4 Aug 2022 11:21:03 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2022 11:21:03 -0000 https://gcc.gnu.org/g:075683767abe15b936ad41792da6ee71e9eda449 commit r13-1956-g075683767abe15b936ad41792da6ee71e9eda449 Author: Ulrich Drepper Date: Thu Aug 4 13:18:05 2022 +0200 Adjust index number of tuple pretty printer The tuple pretty printer uses 1-based indeces which is quite confusing considering the access to the same values with the std::get functions uses 0-based indeces. This patch changes the pretty printer since this is not a guaranteed API. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (class StdTuplePrinter): Use zero-based indeces just like std:get takes. Diff: --- libstdc++-v3/python/libstdcxx/v6/printers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index 17c33c1e54f..d70c8d5d616 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -611,9 +611,9 @@ class StdTuplePrinter: # the value "as is". fields = impl.type.fields () if len (fields) < 1 or fields[0].name != "_M_head_impl": - return ('[%d]' % self.count, impl) + return ('[%d]' % (self.count - 1), impl) else: - return ('[%d]' % self.count, impl['_M_head_impl']) + return ('[%d]' % (self.count - 1), impl['_M_head_impl']) def __init__ (self, typename, val): self.typename = strip_versioned_namespace(typename)