diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-06-08 12:03:25 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-06-08 12:03:25 -0700 |
commit | 0388944a560582abcbf5c7b0257d48918ac11455 (patch) | |
tree | 46f173c54dd26a9c2594e6c450f0004ed0bf6222 | |
parent | 4cab203adf5ab95d8a0cfa986a1da6c9f2b82809 (diff) | |
download | portage-0388944a560582abcbf5c7b0257d48918ac11455.tar.gz portage-0388944a560582abcbf5c7b0257d48918ac11455.tar.bz2 portage-0388944a560582abcbf5c7b0257d48918ac11455.zip |
Atom: avoid TypeError with PyPy
Our test cases pass in raw bytes here, which causes _atom_base.__init__
to raise TypeError with PyPy.
-rw-r--r-- | pym/portage/dep/__init__.py | 6 |
1 files changed, 5 insertions, 1 deletions
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]: |