summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-12-22 14:33:16 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2010-12-22 14:33:16 +0100
commitb221e38a33871bc7040e457051c38ef222e618e5 (patch)
tree6890fa1e14b92d11cadb4d3c229066c25d530869 /python
parent33dd13058d468772153e3182c7d8b126f1e0f6ba (diff)
parent45100d466f6c392758ff2e490cdfee9aae7e55a7 (diff)
downloadpython-apt-b221e38a33871bc7040e457051c38ef222e618e5.tar.gz
merged from the debian branch
Diffstat (limited to 'python')
-rw-r--r--python/depcache.cc1
-rw-r--r--python/generic.h4
2 files changed, 3 insertions, 2 deletions
diff --git a/python/depcache.cc b/python/depcache.cc
index a84eb615..cfa4f5d6 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -1000,7 +1000,6 @@ static PyObject *PkgActionGroupExit(PyObject *Self,PyObject *Args) {
pkgDepCache::ActionGroup *ag = GetCpp<pkgDepCache::ActionGroup*>(Self);
if (ag != NULL)
ag->release();
- Py_DECREF(Self);
Py_RETURN_FALSE;
}
diff --git a/python/generic.h b/python/generic.h
index 7abf7e7a..ce9e5091 100644
--- a/python/generic.h
+++ b/python/generic.h
@@ -79,7 +79,9 @@ 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);
+ // Use Python-internal API, there is no other way to do this
+ // without a memory leak.
+ PyObject *bytes = _PyUnicode_AsDefaultEncodedString(op, 0);
return bytes ? PyBytes_AS_STRING(bytes) : 0;
}