From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id EA4F7385801A for ; Sun, 2 May 2021 10:31:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EA4F7385801A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wm1-x32a.google.com with SMTP id g65so1597299wmg.2 for ; Sun, 02 May 2021 03:31:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TVTFs7tYKpCT3bqiKFqbPqoQP79uk/qHMDq5LLtfV44=; b=Z/daQXnhlZwo67gcxdc+gU5L4s55yCi8YuhM9zxFX4JyPu4xJQ0Dun9rK9ZyGdM10F Hln9D4YTgHQFvBgP2mRKMPDRpoJUppfb7ASuBx7IyWO1Zp9QTaveJQAgvU4F+uib9uof Db6JolYbKDfQTvp9wJ8O03IADMFWLywzCiGHk+RwXRw8jFcyExlprrD0vEv8y2LVDpYE E6zi5IW09UUDOiw/GEFhTwAqugEjX0TK52kPqJUnrg+Bdic1uFk4xYK8NMGWPvI5CaR0 yVNb6A1FvUg2D1ucwXdMafVAgKJGlwNjqfkotqy37NrNojoVM1KsOxkf42UpknqVLzPr tn3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TVTFs7tYKpCT3bqiKFqbPqoQP79uk/qHMDq5LLtfV44=; b=ERuPwXuFuR8pDHooEWsaStDWXFlV/XTdxWF8LWp1NMJhvfMsakEn57TYaHH2oSkWaE pJLNZe8MEY+EIO04BEeqYVaJc4XJpxCzw+8oNJRy7hqkkj17rMHLVHAh/BkDNYOWyPc4 oF8bDXD8PSpq3EvnuPQeKaMfYeEn1HL7ZbrjwOE1dp99OUNcy8QqhB4zzKPOaMFnc5zK t74Cl4tQVVpSXdvfZHKnx9lBkWF4EZLRUk5fcglRvttezTZRwH3+zghGpejz4Tmv+tQn eJZTKqGjLm6ujrbkdTaQ9xGqhxvXPEjvG/erxItM5H5GFFQggmsqn8Y3kzVwXfWI3nUe TaPQ== X-Gm-Message-State: AOAM533OouIB7dTuATM4QampZ0IMur+jgTTrVsyOInUDRtnL8CMXQTcU Fgb8FIezrTgZkM8thamp4rXdaCpGgKHR/A== X-Google-Smtp-Source: ABdhPJzJgPJ03IJ1wEBYuf7iRBbERInz0W1IH5dPgTGsOnhqn1lZPhWW2lEqia6pQtPW6Tu6kaLX1Q== X-Received: by 2002:a1c:1d17:: with SMTP id d23mr16020454wmd.110.1619951495893; Sun, 02 May 2021 03:31:35 -0700 (PDT) Received: from localhost (host109-151-46-70.range109-151.btcentralplus.com. [109.151.46.70]) by smtp.gmail.com with ESMTPSA id i3sm7577482wmq.28.2021.05.02.03.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 May 2021 03:31:35 -0700 (PDT) Date: Sun, 2 May 2021 11:31:34 +0100 From: Andrew Burgess To: gdb-patches@sourceware.org Subject: Re: [PATCH 7/7] gdb: startup commands to control Python extension language Message-ID: <20210502103134.GA11716@embecosm.com> References: <20210429094642.GF2364578@embecosm.com> <70b2bb6d-f5f6-7b35-5838-8949aa422577@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <70b2bb6d-f5f6-7b35-5838-8949aa422577@suse.de> X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 11:27:47 up 1 day, 17:28, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Sun, 02 May 2021 10:31:38 -0000 * Tom de Vries [2021-04-29 12:08:50 +0200]: > On 4/29/21 11:46 AM, Andrew Burgess wrote: > > * Tom de Vries [2021-04-29 10:32:05 +0200]: > > > >> I ran into https://sourceware.org/bugzilla/show_bug.cgi?id=27788 due to > >> having PYTHONDONTWRITEBYTECODE set in my environment. My guess at this > >> point is that this is a test-case issue. > >> > >> I played around a bit with the options and did: > >> ... > >> $ echo $PYTHONDONTWRITEBYTECODE > >> 1 > >> > >> $ gdb -q -batch \ > >> -iex "set python ignore-environment on" \ > >> -iex "show python dont-write-bytecode" > >> Python's dont-write-bytecode setting is auto (currently off). > >> > >> $ gdb -q -batch \ > >> -iex "set python ignore-environment off" \ > >> -iex "show python dont-write-bytecode" > >> Python's dont-write-bytecode setting is auto (currently on). > >> ... > >> which shows that there is an interaction between the two commands. > >> AFAICT, this is not evident from either the NEWS item, or the docs, and > >> I just wonder whether it's a good idea to make this explicit. > > > > Hi Tom, > > > > Thanks for looking at this feature. > > > > The docs for dont-write-bytecode say: > > > > > > > > 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. > > > > > > > > I guess you saw this, but it still didn't seem clear enough? > > > > What if this was extended to something like: > > > > 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. When @command{set python > > ignore-environment on} has been used then Python will ignore > > the environment variable and write out the byte-code files. > > > > I've included the patch below that would make this change. > > > > Hi Andrew, > > LGTM, I just wonder if something like this is not more clear, that is, > reformulate in terms of already explained option value off, rather than > verbosely repeating the off behaviour. So, something like this: > ... > 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. When @command{set python > ignore-environment on} has been used then auto has the same behaviour as > off. > ... > > But then again, this may be a bad idea, I'm not sure. That seems like a good idea to me. Here's the patch I propose to push then (pending doc review from Eli). Thanks, Andrew -- commit 98508d108b973838a7d02029e6686756605affd8 Author: Andrew Burgess Date: Thu Apr 29 10:45:17 2021 +0100 gdb/doc: improve description of set python dont-write-bytecode Extend the description of 'set python dont-write-bytecode' to make the interaction with 'set python ignore-environment' clearer. gdb/doc/ChangeLog: * python.texinfo (Python Commands): Extend description of 'set python dont-write-bytecode'. diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi index 20d65742964..91c9c121117 100644 --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi @@ -136,8 +136,10 @@ (@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. +check the environment variable @env{PYTHONDONTWRITEBYTECODE} to see if +it should write out byte-code or not. When @kbd{set python +ignore-environment on} has been used then @samp{auto} has the same +behaviour as @samp{off}. This option is equivalent to passing @option{-B} to the real @command{python} executable.