summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-06-22 15:53:45 +0200
committerJulian Andres Klode <jak@debian.org>2009-06-22 15:53:45 +0200
commit7c248775da6c86e70a8444630722c92a2dcd676f (patch)
treeaba0419627af4d2cc5ebce4c6c579fa1beb42a8e
parented5de18da963f209badf32778ec7fd027f30311f (diff)
downloadpython-apt-7c248775da6c86e70a8444630722c92a2dcd676f.tar.gz
python/cache.cc: Drop apt_pkg.Cache.open() and apt_pkg.Cache.close().
Drop these functions, because they cause segfaults and memory leaks. To replace this functionality, simply create/delete a Cache object. This way, reference counting can work.
-rw-r--r--debian/changelog4
-rw-r--r--python/cache.cc7
2 files changed, 8 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index f0b3efbe..0ef7e38b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,8 @@ python-apt (0.7.92) UNRELEASED; urgency=low
open() (LP: #320665).
* Add apt_pkg.DepCache.mark_auto() and apt.Package.mark_auto() methods to
mark a package as automatically installed.
+ * Drop apt_pkg.Cache.open() and apt_pkg.Cache.close(), they cause segfaults
+ and memory leaks. Simply create a new cache instead.
[ Sebastian Heinlein ]
* apt/progress.py: Extract the package name from the status message
@@ -30,7 +32,7 @@ python-apt (0.7.92) UNRELEASED; urgency=low
* python/progress.cc:
- low level code for update_status_full and pulse_items()
- -- Julian Andres Klode <jak@debian.org> Mon, 22 Jun 2009 14:38:19 +0200
+ -- Julian Andres Klode <jak@debian.org> Mon, 22 Jun 2009 15:49:03 +0200
python-apt (0.7.91) experimental; urgency=low
diff --git a/python/cache.cc b/python/cache.cc
index 4624dc34..4ce3178c 100644
--- a/python/cache.cc
+++ b/python/cache.cc
@@ -95,6 +95,8 @@ static PyObject *PkgCacheUpdate(PyObject *Self,PyObject *Args)
static PyObject *PkgCacheClose(PyObject *Self,PyObject *Args)
{
+ PyErr_WarnEx(PyExc_DeprecationWarning, "Cache.Close() is deprecated, "
+ "because it causes segfaults. Delete the Cache instead.", 1);
PyObject *CacheFilePy = GetOwner<pkgCache*>(Self);
pkgCacheFile *Cache = GetCpp<pkgCacheFile*>(CacheFilePy);
Cache->Close();
@@ -105,6 +107,9 @@ static PyObject *PkgCacheClose(PyObject *Self,PyObject *Args)
static PyObject *PkgCacheOpen(PyObject *Self,PyObject *Args)
{
+ PyErr_WarnEx(PyExc_DeprecationWarning, "Cache.Open() is deprecated, "
+ "because it causes memory leaks. Create a new Cache instead.",
+ 1);
PyObject *CacheFilePy = GetOwner<pkgCache*>(Self);
pkgCacheFile *Cache = GetCpp<pkgCacheFile*>(CacheFilePy);
@@ -137,8 +142,6 @@ static PyObject *PkgCacheOpen(PyObject *Self,PyObject *Args)
static PyMethodDef PkgCacheMethods[] =
{
{"update",PkgCacheUpdate,METH_VARARGS,"Update the cache"},
- {"open", PkgCacheOpen, METH_VARARGS,"Open the cache"},
- {"close", PkgCacheClose, METH_VARARGS,"Close the cache"},
#ifdef COMPAT_0_7
{"Update",PkgCacheUpdate,METH_VARARGS,"Update the cache"},
{"Open", PkgCacheOpen, METH_VARARGS,"Open the cache"},