summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-07-24 17:53:53 +0200
committerJulian Andres Klode <jak@debian.org>2009-07-24 17:53:53 +0200
commit7a30c8bb4b70f42cc268b4b3a75dab5b414146c4 (patch)
tree68e408e88214fbc006f4aa8d05d2827047a21de4 /python
parent17427c9ba39b56c178e90fde22387d5f2ec525e1 (diff)
downloadpython-apt-7a30c8bb4b70f42cc268b4b3a75dab5b414146c4.tar.gz
python/generic.h: Do not deallocate the temporary bytes object in PyUnicode_AsString.
Diffstat (limited to 'python')
-rw-r--r--python/generic.h6
1 files changed, 1 insertions, 5 deletions
diff --git a/python/generic.h b/python/generic.h
index d7f121ce..75520914 100644
--- a/python/generic.h
+++ b/python/generic.h
@@ -79,11 +79,7 @@ typedef int Py_ssize_t;
static inline const char *PyUnicode_AsString(PyObject *op) {
// Convert to bytes object, using the default encoding.
PyObject *bytes = PyUnicode_AsEncodedString(op,0,0);
- if (!bytes)
- return 0;
- const char *result = PyBytes_AS_STRING(bytes);
- Py_DECREF(bytes);
- return result;
+ return bytes ? PyBytes_AS_STRING(bytes) : 0;
}
// Convert any type of string based object to a const char.