This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: fix PR python/13199
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 10 Jan 2012 14:25:54 -0700
- Subject: FYI: fix PR python/13199
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);