Fixes UnicodeDecodeError in Python 2 with getaddrinfo() error messages
that contain non-ASCII characters, e.g. in pl_PL.UTF-8 locale.
---
 pym/_emerge/actions.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index e482744..66e18a4 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2345,7 +2345,8 @@ def _sync_repo(emerge_config, repo):
                                family, socket.SOCK_STREAM))
                except socket.error as e:
                        writemsg_level(
-                               "!!! getaddrinfo failed for '%s': %s\n" % 
(hostname, e),
+                               "!!! getaddrinfo failed for '%s': %s\n" % 
(hostname,
+                                       _unicode_decode(e.strerror, 
encoding=_encodings['stdio'])),
                                noiselevel=-1, level=logging.ERROR)
 
                if addrinfos:
-- 
2.0.4


Reply via email to