[Python-checkins] cpython: Provide a more readable representation of socket on repr().

giampaolo.rodola python-checkins at python.org
Tue Nov 12 23:09:38 CET 2013


http://hg.python.org/cpython/rev/c5751f01b09b
changeset:   87074:c5751f01b09b
parent:      85942:0d079c66dc23
user:        Giampaolo Rodola' <g.rodola at gmail.com>
date:        Thu Oct 03 21:01:43 2013 +0200
summary:
  Provide a more readable representation of socket on repr().

Before:
<socket.socket fd=3, family=2, type=1, proto=0, laddr=('0.0.0.0', 0)>

Now:
<socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketType.SOCK_STREAM, proto=0, laddr=('0.0.0.0', 0)>

files:
  Lib/socket.py |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Lib/socket.py b/Lib/socket.py
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -136,7 +136,7 @@
         address(es).
         """
         closed = getattr(self, '_closed', False)
-        s = "<%s.%s%s fd=%i, family=%i, type=%i, proto=%i" \
+        s = "<%s.%s%s fd=%i, family=%s, type=%s, proto=%i" \
             % (self.__class__.__module__,
                self.__class__.__name__,
                " [closed]" if closed else "",

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list