summaryrefslogtreecommitdiffstats
path: root/pym/portage/__init__.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2013-01-18 15:05:42 -0800
committerZac Medico <zmedico@gentoo.org>2013-01-18 15:05:42 -0800
commite9a04922c144b267534e3335d2ff3d7bb8994b80 (patch)
tree0c43dc33336066103b605bc7441ac94bc85575b9 /pym/portage/__init__.py
parent71235479ab208318dff391420f9695f5cfaa9594 (diff)
downloadportage-e9a04922c144b267534e3335d2ff3d7bb8994b80.tar.gz
portage-e9a04922c144b267534e3335d2ff3d7bb8994b80.tar.bz2
portage-e9a04922c144b267534e3335d2ff3d7bb8994b80.zip
Add workaround for Python 2.6.4 issue 4978
Avoid "TypeError: keywords must be strings" issue triggered by unicode_literals: http://bugs.python.org/issue4978
Diffstat (limited to 'pym/portage/__init__.py')
-rw-r--r--pym/portage/__init__.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 3bae4deff..94ca7b90f 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -198,6 +198,15 @@ else:
_native_string = _unicode_encode
+if sys.hexversion >= 0x20605f0:
+ def _native_kwargs(kwargs):
+ return kwargs
+else:
+ # Avoid "TypeError: keywords must be strings" issue triggered
+ # by unicode_literals: http://bugs.python.org/issue4978
+ def _native_kwargs(kwargs):
+ return dict((_native_string(k), v) for k, v in kwargs.iteritems())
+
class _unicode_func_wrapper(object):
"""
Wraps a function, converts arguments from unicode to bytes,