From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id NK10JVDs3WL8/RkAWB0awg (envelope-from ) for ; Sun, 24 Jul 2022 21:05:20 -0400 Received: by simark.ca (Postfix, from userid 112) id 897321E5EA; Sun, 24 Jul 2022 21:05:20 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=tWF7j8sm; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 2763F1E21F for ; Sun, 24 Jul 2022 21:05:20 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5A3483852748 for ; Mon, 25 Jul 2022 01:05:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A3483852748 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1658711119; bh=u3TBJQPAM7HAksy56w+a3mLt0VbhSP1ifuNEyGeQOos=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=tWF7j8smIBJrhTVeeGY7Ajc1PJjTg0oggSdFA2wMlZrwLoKKXhhNAqy78o9RFHotc gHAer7EZBb4PAMdh1jErJRavA6plm4Sa99Y4meuOtgMJMNLHx5A0mZzUBFYTpO5Ore BqCoKapw4p21HWiRXiZnVo4gWQ38W7AQa5QL50Qk= Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id EB2CD385842E for ; Mon, 25 Jul 2022 01:04:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EB2CD385842E Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 6C4A51E21F; Sun, 24 Jul 2022 21:04:59 -0400 (EDT) Message-ID: Date: Sun, 24 Jul 2022 21:04:58 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2] set/show python dont-write-bytecode fixes Content-Language: en-US To: Kevin Buettner , gdb-patches@sourceware.org References: <20220723212324.1028060-1-kevinb@redhat.com> In-Reply-To: <20220723212324.1028060-1-kevinb@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Simon Marchi via Gdb-patches Reply-To: Simon Marchi Cc: Pedro Alves Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 2022-07-23 17:23, Kevin Buettner wrote: > GDB uses the environment variable PYTHONDONTWRITEBYTECODE to > determine whether or not to write the result of byte-compiling > python modules when the "python dont-write-bytecode" setting > is "auto". Simon noticed that GDB's implementation doesn't > follow the Python documentation. > > At present, GDB only checks for the existence of this environment > variable. That is not sufficient though. Regarding > PYTHONDONTWRITEBYTECODE, this document... > > https://docs.python.org/3/using/cmdline.html > > ...says: > > If this is set to a non-empty string, Python won't try to write > .pyc files on the import of source modules. > > This commit fixes GDB's handling of PYTHONDONTWRITEBYTECODE by adding > an empty string check. > > This commit also corrects the set/show command documentation for > "python dont-write-bytecode". The current doc was just a copy > of that for set/show python ignore-environment. > > During his review of an earlier version of this patch, Eli Zaretskii > asked that the help text that I proposed for "set/show python > dont-write-bytecode" be expanded. I've done that in addition to > clarifying the documentation of this option in the GDB manual. > --- > gdb/doc/python.texi | 11 ++++++++--- > gdb/python/python.c | 32 +++++++++++++++++++++++++------- > 2 files changed, 33 insertions(+), 10 deletions(-) > > diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi > index eeb847aeaa8..6d7bb832c22 100644 > --- a/gdb/doc/python.texi > +++ b/gdb/doc/python.texi > @@ -134,9 +134,14 @@ initialized early during @value{GDBN}'s startup process, then this > option must be placed into the early initialization file > (@pxref{Initialization Files}) to have the desired effect. > > -By default this option is set to @samp{auto}, in this mode Python will > -check the environment variable @env{PYTHONDONTWRITEBYTECODE} to see > -if it should write out byte-code or not. > +By default this option is set to @samp{auto}. In this mode, provided > +the @code{python ignore-environment} setting is @samp{off}, the > +environment variable @env{PYTHONDONTWRITEBYTECODE} is examined to see > +if it should write out byte-code or not. Spurious space at the end of this line. Otherwise, LGTM. Simon