summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt/cache.py1
-rw-r--r--debian/changelog17
-rw-r--r--python/depcache.cc15
3 files changed, 31 insertions, 2 deletions
diff --git a/apt/cache.py b/apt/cache.py
index 59fe7664..828b167b 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -135,6 +135,7 @@ class Cache(object):
return self._weakref[key]
except KeyError:
if key in self._set:
+ key = str(key)
pkg = self._weakref[key] = Package(self, self._cache[key])
return pkg
else:
diff --git a/debian/changelog b/debian/changelog
index 642dc456..00900dad 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,9 +1,22 @@
-python-apt (0.7.13.2) UNRELEASED; urgency=low
+python-apt (0.7.13.3) UNRELEASED; urgency=low
+ [ Michael Vogt ]
* apt/cache.py:
- add actiongroup() method (backport from 0.7.92)
- -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 24 Aug 2009 13:41:38 +0200
+ [ Julian Andres Klode ]
+ * python/depcache.cc:
+ - Make ActionGroups context managers so apt.Cache.actiongroup() has
+ the same behavior as in 0.7.92
+
+ -- Julian Andres Klode <jak@debian.org> Mon, 24 Aug 2009 15:43:00 +0200
+
+python-apt (0.7.13.2) unstable; urgency=low
+
+ * apt/cache.py:
+ - Convert argument to str in __getitem__() (Closes: #542965).
+
+ -- Julian Andres Klode <jak@debian.org> Sat, 22 Aug 2009 22:47:30 +0200
python-apt (0.7.13.1) unstable; urgency=low
diff --git a/python/depcache.cc b/python/depcache.cc
index 0e83c956..7edb7b59 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -794,9 +794,24 @@ static PyObject *PkgActionGroupRelease(PyObject *Self,PyObject *Args)
return HandleErrors(Py_None);
}
+static PyObject *PkgActionGroupEnter(PyObject *Self,PyObject *Args) {
+ if (PyArg_ParseTuple(Args,"") == 0)
+ return 0;
+ Py_INCREF(Self);
+ return Self;
+}
+static PyObject *PkgActionGroupExit(PyObject *Self,PyObject *Args) {
+ pkgDepCache::ActionGroup *ag = GetCpp<pkgDepCache::ActionGroup*>(Self);
+ ag->release();
+ Py_RETURN_FALSE;
+}
+
+
static PyMethodDef PkgActionGroupMethods[] =
{
{"release", PkgActionGroupRelease, METH_VARARGS, "release()"},
+ {"__enter__", PkgActionGroupEnter, METH_VARARGS, "__enter__() -> self"},
+ {"__exit__", PkgActionGroupExit, METH_VARARGS, "__exit__()"},
{}
};