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)>
This commit is contained in:
Giampaolo Rodola' 2013-10-03 21:01:43 +02:00
parent 5179445520
commit b62814998a
1 changed files with 1 additions and 1 deletions

View File

@ -136,7 +136,7 @@ class socket(_socket.socket):
address(es). address(es).
""" """
closed = getattr(self, '_closed', False) 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__.__module__,
self.__class__.__name__, self.__class__.__name__,
" [closed]" if closed else "", " [closed]" if closed else "",