From d8cd294a4cd4d984f4119d712718b62fab7c1b14 Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Mon, 21 Sep 2009 18:02:08 +0000 Subject: Decode all keys in dictionary containing environment passed to os.execve() in portage.process._exec() for compatibility with Python 3. svn path=/main/trunk/; revision=14352 --- pym/portage/process.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pym/portage/process.py') diff --git a/pym/portage/process.py b/pym/portage/process.py index 6ce304b4f..428c66f4c 100644 --- a/pym/portage/process.py +++ b/pym/portage/process.py @@ -11,6 +11,7 @@ import traceback from portage import os from portage import _encodings +from portage import _unicode_decode from portage import _unicode_encode import portage portage.proxy.lazyimport.lazyimport(globals(), @@ -372,8 +373,13 @@ def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask, if pre_exec: pre_exec() + # Decode all keys for compatibility with Python 3. + env_decoded = {} + for k, v in env.items(): + env_decoded[_unicode_decode(k)] = v + # And switch to the new process. - os.execve(binary, myargs, env) + os.execve(binary, myargs, env_decoded) def find_binary(binary): """ -- cgit v1.2.3-1-g7c22