public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] fakedbapi.cpv_exists: handle KeyError from _instance_key
@ 2015-09-24 20:27 Zac Medico
  2015-09-24 20:29 ` Brian Dolbec
  0 siblings, 1 reply; 2+ messages in thread
From: Zac Medico @ 2015-09-24 20:27 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

Since commit 7921e61065502fd0bb08d9dfef6a4493657961bf, cpv_exists
needs to handle KeyError from _instance_key_multi_instance.

Fixes: 7921e6106550 ("binpkg-multi-instance 2 of 7")
---
 pym/portage/dbapi/virtual.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/pym/portage/dbapi/virtual.py b/pym/portage/dbapi/virtual.py
index a59c3b5..f2e841f 100644
--- a/pym/portage/dbapi/virtual.py
+++ b/pym/portage/dbapi/virtual.py
@@ -98,8 +98,12 @@ class fakedbapi(dbapi):
 		return result[:]
 
 	def cpv_exists(self, mycpv, myrepo=None):
-		return self._instance_key(mycpv,
-			support_string=True) in self.cpvdict
+		try:
+			return self._instance_key(mycpv,
+				support_string=True) in self.cpvdict
+		except KeyError:
+			# _instance_key failure
+			return False
 
 	def cp_list(self, mycp, use_cache=1, myrepo=None):
 		# NOTE: Cache can be safely shared with the match cache, since the
-- 
2.4.6



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] fakedbapi.cpv_exists: handle KeyError from _instance_key
  2015-09-24 20:27 [gentoo-portage-dev] [PATCH] fakedbapi.cpv_exists: handle KeyError from _instance_key Zac Medico
@ 2015-09-24 20:29 ` Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2015-09-24 20:29 UTC (permalink / raw
  To: gentoo-portage-dev

On Thu, 24 Sep 2015 13:27:46 -0700
Zac Medico <zmedico@gentoo.org> wrote:

> Since commit 7921e61065502fd0bb08d9dfef6a4493657961bf, cpv_exists
> needs to handle KeyError from _instance_key_multi_instance.
> 
> Fixes: 7921e6106550 ("binpkg-multi-instance 2 of 7")
> ---
>  pym/portage/dbapi/virtual.py | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/pym/portage/dbapi/virtual.py
> b/pym/portage/dbapi/virtual.py index a59c3b5..f2e841f 100644
> --- a/pym/portage/dbapi/virtual.py
> +++ b/pym/portage/dbapi/virtual.py
> @@ -98,8 +98,12 @@ class fakedbapi(dbapi):
>  		return result[:]
>  
>  	def cpv_exists(self, mycpv, myrepo=None):
> -		return self._instance_key(mycpv,
> -			support_string=True) in self.cpvdict
> +		try:
> +			return self._instance_key(mycpv,
> +				support_string=True) in self.cpvdict
> +		except KeyError:
> +			# _instance_key failure
> +			return False
>  
>  	def cp_list(self, mycp, use_cache=1, myrepo=None):
>  		# NOTE: Cache can be safely shared with the match
> cache, since the


Thanks Zac. push please.
-- 
Brian Dolbec <dolsen>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-24 20:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-24 20:27 [gentoo-portage-dev] [PATCH] fakedbapi.cpv_exists: handle KeyError from _instance_key Zac Medico
2015-09-24 20:29 ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox