[Python-checkins] r83214 - python/branches/py3k/Lib/os.py

victor.stinner python-checkins at python.org
Wed Jul 28 23:23:23 CEST 2010


Author: victor.stinner
Date: Wed Jul 28 23:23:23 2010
New Revision: 83214

Log:
#9283: Fix repr(os.environ), display unicode keys and values on POSIX systems


Modified:
   python/branches/py3k/Lib/os.py

Modified: python/branches/py3k/Lib/os.py
==============================================================================
--- python/branches/py3k/Lib/os.py	(original)
+++ python/branches/py3k/Lib/os.py	Wed Jul 28 23:23:23 2010
@@ -446,7 +446,9 @@
         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)


More information about the Python-checkins mailing list