public inbox for archer-commits@sourceware.org help / color / mirror / Atom feed
From: pmuldoon@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-tromey-python: [python] python-utils.c (python_string_to_unicode): Always return a new reference. Date: Thu, 26 Feb 2009 08:45:00 -0000 [thread overview] Message-ID: <20090226084517.25390.qmail@sourceware.org> (raw) The branch, archer-tromey-python has been updated via b5235efef9aa1d619d8a5defc5aa1219dff76d3d (commit) from 9f534e722211caffa7caef5cd11c5da2ac24f6c4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit b5235efef9aa1d619d8a5defc5aa1219dff76d3d Author: Phil Muldoon <pmuldoon@redhat.com> Date: Thu Feb 26 08:44:03 2009 +0000 [python] python-utils.c (python_string_to_unicode): Always return a new reference. 2009-02-26 Phil Muldoon <pmuldoon@redhat.com> * python/python-utils.c (python_string_to_unicode): Always return a new reference. (python_string_to_target_string): Decrement transient python instance. (python_string_to_host_string): Likewise. ----------------------------------------------------------------------- Summary of changes: gdb/python/python-utils.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) First 500 lines of diff: diff --git a/gdb/python/python-utils.c b/gdb/python/python-utils.c index c6c305f..f9c9486 100644 --- a/gdb/python/python-utils.c +++ b/gdb/python/python-utils.c @@ -82,7 +82,11 @@ python_string_to_unicode (PyObject *obj) /* If obj is already a unicode string, just return it. I wish life was always that simple... */ if (PyUnicode_Check (obj)) - unicode_str = obj; + { + unicode_str = obj; + Py_INCREF (obj); + } + else if (PyString_Check (obj)) unicode_str = PyUnicode_FromEncodedObject (obj, host_charset (), NULL); else @@ -137,12 +141,15 @@ char * python_string_to_target_string (PyObject *obj) { PyObject *str; + char *result; str = python_string_to_unicode (obj); if (str == NULL) return NULL; - return unicode_to_target_string (str); + result = unicode_to_target_string (str); + Py_DECREF (str); + return result; } /* Converts a python string (8-bit or unicode) to a target string in @@ -153,12 +160,15 @@ char * python_string_to_host_string (PyObject *obj) { PyObject *str; + char *result; str = python_string_to_unicode (obj); if (str == NULL) return NULL; - return unicode_to_encoded_string (str, host_charset ()); + result = unicode_to_encoded_string (str, host_charset ()); + Py_DECREF (str); + return result; } /* Converts a target string of LENGTH bytes in the target's charset to a hooks/post-receive -- Repository for Project Archer.
reply other threads:[~2009-02-26 8:45 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=20090226084517.25390.qmail@sourceware.org \ --to=pmuldoon@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).