From b26842e8265252407a9a2d2ab9c4cb3030ef014c Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sat, 7 Dec 2013 12:33:20 +0100 Subject: [PATCH] [entropy.db] direct: wrap yield around a try/finally block --- lib/entropy/db/skel.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/entropy/db/skel.py b/lib/entropy/db/skel.py index 34646fa9a..cc3895f2b 100644 --- a/lib/entropy/db/skel.py +++ b/lib/entropy/db/skel.py @@ -454,9 +454,10 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore): counter = getattr(self._tls, "_EntropyRepositoryCacheCounter", 0) self._tls._EntropyRepositoryCacheCounter = counter + 1 - yield - - self._tls._EntropyRepositoryCacheCounter -= 1 + try: + yield + finally: + self._tls._EntropyRepositoryCacheCounter -= 1 def directed(self): """