summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-06-29 23:44:55 +0000
committerZac Medico <zmedico@gentoo.org>2009-06-29 23:44:55 +0000
commit734d8f21c0de0df2eba4e326a0c281ca0283e920 (patch)
tree250220190c8ed8cbb59474bf09502f53c84a1ba4
parentad5c97c5d856a12fb6cd40c9a9690deeba4bcb0e (diff)
downloadportage-734d8f21c0de0df2eba4e326a0c281ca0283e920.tar.gz
portage-734d8f21c0de0df2eba4e326a0c281ca0283e920.tar.bz2
portage-734d8f21c0de0df2eba4e326a0c281ca0283e920.zip
Use a finally blocker to ensure _expand_new_virtuals properly resets eapi
state when an exception is raised. svn path=/main/trunk/; revision=13738
-rw-r--r--pym/portage/__init__.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index af2a1de92..2da9e198b 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -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(