summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-12-12 18:56:35 +0000
committerZac Medico <zmedico@gentoo.org>2009-12-12 18:56:35 +0000
commit0c98fa55401c7e1cb4fb1fc4c3c79ae77440f215 (patch)
treea99186e9ee95a7a3e747489d6852d6117027e65a
parent3bd598792a7f4c8aac8b7b40b6c4ffb1fcf4860a (diff)
downloadportage-0c98fa55401c7e1cb4fb1fc4c3c79ae77440f215.tar.gz
portage-0c98fa55401c7e1cb4fb1fc4c3c79ae77440f215.tar.bz2
portage-0c98fa55401c7e1cb4fb1fc4c3c79ae77440f215.zip
Bug #296641 - Avoid UnicodeEncodeError with python2 in eapi_is_supported()
triggered by corrupt EAPI. svn path=/main/trunk/; revision=15055
-rw-r--r--pym/portage/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 69533c7c0..0e26acbc8 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -6080,7 +6080,11 @@ def _eapi_is_deprecated(eapi):
return eapi in _deprecated_eapis
def eapi_is_supported(eapi):
- eapi = str(eapi).strip()
+ if not isinstance(eapi, basestring):
+ # Only call str() when necessary since with python2 it
+ # can trigger UnicodeEncodeError if EAPI is corrupt.
+ eapi = str(eapi)
+ eapi = eapi.strip()
if _eapi_is_deprecated(eapi):
return True