From: Zac Medico Date: Mon, 29 Jun 2009 23:44:55 +0000 (-0000) Subject: Use a finally blocker to ensure _expand_new_virtuals properly resets eapi X-Git-Tag: v2.2_rc34~122 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=734d8f21c0de0df2eba4e326a0c281ca0283e920;p=portage.git Use a finally blocker to ensure _expand_new_virtuals properly resets eapi state when an exception is raised. svn path=/main/trunk/; revision=13738 --- 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(