From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 7/7] gdb: startup commands to control Python extension language
Date: Thu, 29 Apr 2021 10:46:42 +0100 [thread overview]
Message-ID: <20210429094642.GF2364578@embecosm.com> (raw)
In-Reply-To: <f4b440c9-3550-82a6-b96a-60a55ac0b9dd@suse.de>
* Tom de Vries <tdevries@suse.de> [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:
<snip>
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.
<snip>
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.
Thanks,
Andrew
---
commit 1557998d9d8e9b0587500980bd8731bb55a1c299
Author: Andrew Burgess <andrew.burgess@embecosm.com>
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..26e1446f005 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 @command{set python
+ignore-environment on} has been used then Python will ignore the
+environment variable and write out the byte-code files.
This option is equivalent to passing @option{-B} to the real
@command{python} executable.
next prev parent reply other threads:[~2021-04-29 9:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-22 21:02 [PATCH 0/7] New options to control how Python is initialized Andrew Burgess
2021-04-22 21:02 ` [PATCH 1/7] gdb: remove unused argument from gdb_init Andrew Burgess
2021-04-23 14:15 ` Tom Tromey
2021-04-22 21:02 ` [PATCH 2/7] gdb: ensure SIGINT is set to SIG_DFL during initialisation Andrew Burgess
2021-04-23 14:16 ` Tom Tromey
2021-04-22 21:02 ` [PATCH 3/7] gdb: delay python initialisation until gdbpy_finish_initialization Andrew Burgess
2021-04-23 14:26 ` Tom Tromey
2021-04-22 21:02 ` [PATCH 4/7] gdb delay guile initialization until gdbscm_finish_initialization Andrew Burgess
2021-04-23 14:29 ` Tom Tromey
2021-04-22 21:02 ` [PATCH 5/7] gdb: initialise extension languages after processing early startup files Andrew Burgess
2021-04-23 14:30 ` Tom Tromey
2021-04-22 21:02 ` [PATCH 6/7] gdb: extension languages finish_initialization to initialize Andrew Burgess
2021-04-23 14:31 ` Tom Tromey
2021-04-22 21:02 ` [PATCH 7/7] gdb: startup commands to control Python extension language Andrew Burgess
2021-04-23 10:31 ` Eli Zaretskii
2021-04-23 14:32 ` Tom Tromey
2021-04-29 8:32 ` Tom de Vries
2021-04-29 9:35 ` Andrew Burgess
2021-04-29 9:46 ` Andrew Burgess [this message]
2021-04-29 10:08 ` Tom de Vries
2021-05-02 10:31 ` Andrew Burgess
2021-05-02 18:15 ` Tom de Vries
2021-04-29 12:17 ` Eli Zaretskii
2021-04-29 12:32 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210429094642.GF2364578@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).