From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id a8QYCp5s4mkTgR8AWB0awg (envelope-from ) for ; Fri, 17 Apr 2026 13:23:42 -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=s3cZNJqR; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 1303D1E04F; Fri, 17 Apr 2026 13:23:42 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 652191E04F for ; Fri, 17 Apr 2026 13:23:41 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id DBA954AA3978 for ; Fri, 17 Apr 2026 17:23:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBA954AA3978 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=s3cZNJqR Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by sourceware.org (Postfix) with ESMTPS id 2F1D54CCCA20 for ; Fri, 17 Apr 2026 17:23:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2F1D54CCCA20 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 2F1D54CCCA20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776446583; cv=none; b=CkkSV78n8U08buexpttLQ3CNci2NZQaxECcVTHJ8jSN6x7g513TIcwLGBbreL9HQpeMw/t8OipoExKmV96KYp6SM9kXwjBTSw/UCj8rZ+9F9UOtVqi+dy7kh6SV9bvnXXKiHwZOAyuAAwemFBA+vX9y/2g3iOibqw6VACKIn5hQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776446583; c=relaxed/simple; bh=1kEqzQ1KUeER6L3BgYinYwrT/JzNaQQH2Tpswwnr9+o=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=b/bC3q4Ccu+Zaz3h+pSXXihpY5W6yayDHF0DdJvE6Pe572u8X8ZvTZtMOh5Ju4ENzsiaWu3l+mAccphNh2Pv6xlSPMRV4PuJnl+8YAHnxL5peyCXaQx2Ic9F5TXDkpKQJfVlfF0woHRt2dugHXFZlHn4q80D6laplVnQRFC3dUk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F1D54CCCA20 Received: from eig-obgw-6003b.ext.cloudfilter.net ([10.0.30.175]) by cmsmtp with ESMTPS id DkLYwC068nwj2DmuDwuEsN; Fri, 17 Apr 2026 17:23:01 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id DmuCwkBztHtqhDmuCwalvR; Fri, 17 Apr 2026 17:23:00 +0000 X-Authority-Analysis: v=2.4 cv=AtXu3P9P c=1 sm=1 tr=0 ts=69e26c75 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=A5OVakUREuEA:10 a=ItBw4LHWJt0A:10 a=7CQSdrXTAAAA:8 a=1npyhLyl3dsRHEg7t7AA:9 a=a-qgeE7W1pNrGK8U0ZQC:22 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=BvVFdHNbVHW1JBDcG7DTbPO8ySsS6rytcIDLWdhIx1Y=; b=s3cZNJqREnZ+0B4xCILZDKKwb5 Kf7/sfkCiKc3UhT4MGBpF/rPsFvyA39Nj+dCndy7D8+7LdU+IzhlQ6OHugITEnRSIJWqOfIGIo7cn 2US1sK4incuXWKJwASFltEDjk; Received: from 75-166-225-82.hlrn.qwest.net ([75.166.225.82]:59646 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wDmuC-00000000f50-1141; Fri, 17 Apr 2026 11:23:00 -0600 From: Tom Tromey To: Matthieu Longo Cc: , Tom Tromey Subject: Re: [PATCH v1 2/4] gdb/python: eval_python_command returns both exit code and result In-Reply-To: <20260409105155.1416274-3-matthieu.longo@arm.com> (Matthieu Longo's message of "Thu, 9 Apr 2026 11:51:53 +0100") References: <20260409105155.1416274-1-matthieu.longo@arm.com> <20260409105155.1416274-3-matthieu.longo@arm.com> X-Attribution: Tom Date: Fri, 17 Apr 2026 11:22:59 -0600 Message-ID: <87ik9psdqk.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain 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: 1wDmuC-00000000f50-1141 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-225-82.hlrn.qwest.net (bapiya) [75.166.225.82]:59646 X-Source-Auth: tom+tromey.com X-Email-Count: 7 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfMpuYe4SErd8+4dIBGHL1vIKGWHswMZIemI8aLMcaCXJBFgTpQ2OBloOd9W1SrSt+XEPyQaYV65xAbJ2elS2+h4+C9lG7I+qyU84boJOZzHNg7U/aE+r s++Gb172y1otZ5tymj5xa4Y3SuZQdJKsg0HbS2z58GL1r2EXHuZ5R9dc2WTFopUXqFKfMG25UJZANxkj0Dk+jFchngez2FE9K1A= 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 >>>>> Matthieu Longo writes: > A previous commit [1] centralized the Python code evaluation in the > helper function eval_python_command(). However, a missed case in > varobj_set_visualizer() requires both the exit code and the result > of the evaluation. > This patch updates eval_python_command() to return both values and > adjusts existing callers accordingly. It also replaces the use of > PyRun_String() in varobj_set_visualizer() with a call to > eval_python_command(). Could we have it just return null on failure? And always return a gdbpy_ref<>? > --- a/gdb/python/python.c > +++ b/gdb/python/python.c > @@ -299,42 +299,40 @@ gdbpy_check_quit_flag (const struct extension_language_defn *extlang) > NULL means that this is evaluating a string, not the contents of a > file. */ > -int > +std::pair> > eval_python_command (const char *command, int start_symbol, > const char *filename) Either way I think the comment needs an update to describe the return result. > + if (mainmod == nullptr) > + return std::make_pair(-1, nullptr); Space before parens throughout, though of course this is moot if returning gdbpy_ref<>. Tom