public inbox for archer-commits@sourceware.org help / color / mirror / Atom feed
From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] tromey/python: Fix Python3 compatibility. Date: Wed, 04 Feb 2015 16:28:00 -0000 [thread overview] Message-ID: <20150204162834.21435.qmail@sourceware.org> (raw) The branch, tromey/python has been updated via 55b3f8bf6f2ecf9b4f7115d9cf7a34cc1fd9593f (commit) from ef5e5e4d5bfedecf54ef7f1380eaf89662b617d0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 55b3f8bf6f2ecf9b4f7115d9cf7a34cc1fd9593f Author: Jan Kratochvil <jan.kratochvil@redhat.com> Date: Wed Feb 4 17:28:20 2015 +0100 Fix Python3 compatibility. ----------------------------------------------------------------------- Summary of changes: gdb/python/python.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) First 500 lines of diff: diff --git a/gdb/python/python.c b/gdb/python/python.c index 8eb8afe..54a2d9b 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -1258,7 +1258,34 @@ run_python_script (int argc, char **argv) ensure_python_env (get_current_arch (), current_language); running_python_script = 1; + +#if PYTHON_ABI_VERSION < 3 PySys_SetArgv (argc - 1, argv + 1); +#else + { + wchar_t **wargv = alloca (sizeof (*wargv) * (argc + 1)); + int i; + + for (i = 1; i < argc; i++) + { + size_t len = mbstowcs (NULL, argv[i], 0); + size_t len2; + + if (len == (size_t) -1) + { + fprintf (stderr, "Invalid multibyte argument #%d \"%s\"\n", + i, argv[i]); + exit (1); + } + wargv[i] = alloca (sizeof (**wargv) * (len + 1)); + len2 = mbstowcs (wargv[i], argv[i], len + 1); + assert (len2 == len); + } + wargv[argc] = NULL; + PySys_SetArgv (argc - 1, wargv + 1); + } +#endif + input = fopen (argv[0], "r"); if (! input) { hooks/post-receive -- Repository for Project Archer.
reply other threads:[~2015-02-04 16:28 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=20150204162834.21435.qmail@sourceware.org \ --to=jkratoch@sourceware.org \ --cc=archer-commits@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: linkBe 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).