From 4fcfe8b00e52a21c2144877fb631a70d6c75fd19 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 22 Aug 2009 22:56:18 +0200 Subject: apt/cache.py: Convert argument to str in __getitem__() (Closes: #542965). --- apt/cache.py | 1 + debian/changelog | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/apt/cache.py b/apt/cache.py index 756f9ba9..446cfae7 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 b75d07b7..2da5bc58 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +python-apt (0.7.13.2) unstable; urgency=low + + * apt/cache.py: + - Convert argument to str in __getitem__() (Closes: #542965). + + -- Julian Andres Klode Sat, 22 Aug 2009 22:47:30 +0200 + python-apt (0.7.13.1) unstable; urgency=low * apt/package.py: -- cgit v1.2.3 From b564655353399acb70431b31c63f3df08c5d42ab Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 24 Aug 2009 15:46:29 +0200 Subject: * python/depcache.cc: - Make ActionGroups context managers so apt.Cache.actiongroup() has the same behavior as in 0.7.92 --- debian/changelog | 10 ++++++++-- python/depcache.cc | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index eddd9194..00900dad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,16 @@ python-apt (0.7.13.3) UNRELEASED; urgency=low + [ Michael Vogt ] * apt/cache.py: - add actiongroup() method (backport from 0.7.92) - -- Michael Vogt 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 Mon, 24 Aug 2009 15:43:00 +0200 + python-apt (0.7.13.2) unstable; urgency=low * apt/cache.py: 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(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__()"}, {} }; -- cgit v1.2.3