From 7c248775da6c86e70a8444630722c92a2dcd676f Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 22 Jun 2009 15:53:45 +0200 Subject: 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. --- python/cache.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'python/cache.cc') 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(Self); pkgCacheFile *Cache = GetCpp(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(Self); pkgCacheFile *Cache = GetCpp(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"}, -- cgit v1.2.3