From d73c1a3009d4bf0212d0d59111c1191066e245e4 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 28 Jul 2010 21:23:23 +0000 Subject: [PATCH] #9283: Fix repr(os.environ), display unicode keys and values on POSIX systems --- Lib/os.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/os.py b/Lib/os.py index e9d44cc614b..2f78d8dfce4 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)