public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r15055 - main/trunk/pym/portage
@ 2009-12-12 18:56 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2009-12-12 18:56 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2009-12-12 18:56:35 +0000 (Sat, 12 Dec 2009)
New Revision: 15055

Modified:
   main/trunk/pym/portage/__init__.py
Log:
Bug #296641 - Avoid UnicodeEncodeError with python2 in eapi_is_supported()
triggered by corrupt EAPI.


Modified: main/trunk/pym/portage/__init__.py
===================================================================
--- main/trunk/pym/portage/__init__.py	2009-12-12 18:37:41 UTC (rev 15054)
+++ main/trunk/pym/portage/__init__.py	2009-12-12 18:56:35 UTC (rev 15055)
@@ -6080,7 +6080,11 @@
 	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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-12-12 18:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-12 18:56 [gentoo-commits] portage r15055 - main/trunk/pym/portage Zac Medico (zmedico)

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