From: Zac Medico Date: Wed, 8 Jun 2011 19:03:25 +0000 (-0700) Subject: Atom: avoid TypeError with PyPy X-Git-Tag: v2.2.0_alpha39~20 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0388944a560582abcbf5c7b0257d48918ac11455;p=portage.git Atom: avoid TypeError with PyPy Our test cases pass in raw bytes here, which causes _atom_base.__init__ to raise TypeError with PyPy. --- diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 8332a05e4..862154318 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -30,7 +30,7 @@ __all__ = [ import re, sys import warnings from itertools import chain -import portage.exception +from portage import _unicode_decode from portage.eapi import eapi_has_slot_deps, eapi_has_src_uri_arrows, \ eapi_has_use_deps, eapi_has_strong_blocks, eapi_has_use_dep_defaults from portage.exception import InvalidAtom, InvalidData, InvalidDependString @@ -1057,6 +1057,10 @@ class Atom(_atom_base): raise TypeError(_("Expected %s, got %s") % \ (_atom_base, type(s))) + if not isinstance(s, _atom_base): + # Avoid TypeError with from _atom_base.__init__ with PyPy. + s = _unicode_decode(s) + _atom_base.__init__(s) if "!" == s[:1]: