From 734d8f21c0de0df2eba4e326a0c281ca0283e920 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 29 Jun 2009 23:44:55 +0000 Subject: [PATCH] Use a finally blocker to ensure _expand_new_virtuals properly resets eapi state when an exception is raised. svn path=/main/trunk/; revision=13738 --- pym/portage/__init__.py | 17 +++++++++-------- 1 file 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( -- 2.26.2