From: Victor Stinner Date: Wed, 28 Jul 2010 21:23:23 +0000 (+0000) Subject: #9283: Fix repr(os.environ), display unicode keys and values on POSIX systems X-Git-Tag: v3.2a1~76 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d73c1a3009d4bf0212d0d59111c1191066e245e4;p=thirdparty%2FPython%2Fcpython.git #9283: Fix repr(os.environ), display unicode keys and values on POSIX systems --- diff --git a/Lib/os.py b/Lib/os.py index e9d44cc614bb..2f78d8dfce4c 100644 --- a/Lib/os.py +++ b/Lib/os.py @@ -446,7 +446,9 @@ class _Environ(MutableMapping): return len(self.data) def __repr__(self): - return 'environ({!r})'.format(self.data) + return 'environ({})'.format(', '.join( + ('{!r}: {!r}'.format(self.decodekey(key), self.decodevalue(value)) + for key, value in self.data.items()))) def copy(self): return dict(self)