public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: FYI: fix PR python/13199
Date: Tue, 10 Jan 2012 21:29:00 -0000	[thread overview]
Message-ID: <m3ty43b671.fsf@fleche.redhat.com> (raw)

I'm checking this in on the trunk.

This changes the Python startup to set sys.argv.
This is needed by some Python modules.

I think it is best to set argv this way, because we don't have any
scripting support.  We may add this (the old branch has 'gdb -P'), but
in the meantime this fixes a problem.

Tom

2012-01-10  Tom Tromey  <tromey@redhat.com>

	PR python/13199:
	* python/python.c (finish_python_initialization): Set sys.argv.

diff --git a/gdb/python/python.c b/gdb/python/python.c
index b0b9a9c..61386a5 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -1369,6 +1369,9 @@ def GdbSetPythonDirectory (dir):\n\
 GdbSetPythonDirectory (gdb.PYTHONDIR)\n\
 # Default prompt hook does nothing.\n\
 prompt_hook = None\n\
+# Ensure that sys.argv is set to something.\n\
+# We do not use PySys_SetArgvEx because it did not appear until 2.6.6.\n\
+sys.argv = ['']\n\
 ");
 
   do_cleanups (cleanup);

                 reply	other threads:[~2012-01-10 21:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=m3ty43b671.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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).