Use a finally blocker to ensure _expand_new_virtuals properly resets eapi
authorZac Medico <zmedico@gentoo.org>
Mon, 29 Jun 2009 23:44:55 +0000 (23:44 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 29 Jun 2009 23:44:55 +0000 (23:44 -0000)
state when an exception is raised.

svn path=/main/trunk/; revision=13738

pym/portage/__init__.py

index af2a1de923a6c7c36460386e15f396cdd830bf5d..2da9e198b5b8a5fa7be454b45ad733955a08234c 100644 (file)
@@ -6984,14 +6984,15 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/",
                        prev_eapi = mytrees.get("eapi")
                        mytrees["eapi"] = virtual_eapi
 
-                       mycheck = dep_check(depstring, mydbapi, mysettings, myroot=myroot,
-                               trees=trees, **pkg_kwargs)
-
-                       # Restore previous EAPI after recursion.
-                       if prev_eapi is not None:
-                               mytrees["eapi"] = prev_eapi
-                       else:
-                               del mytrees["eapi"]
+                       try:
+                               mycheck = dep_check(depstring, mydbapi, mysettings,
+                                       myroot=myroot, trees=trees, **pkg_kwargs)
+                       finally:
+                               # Restore previous EAPI after recursion.
+                               if prev_eapi is not None:
+                                       mytrees["eapi"] = prev_eapi
+                               else:
+                                       del mytrees["eapi"]
 
                        if not mycheck[0]:
                                raise portage.exception.ParseError(