[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7

2014-07-26 Thread STINNER Victor
STINNER Victor added the comment: > I afraid this can break doctests. Isn't this against policy? Ok, I close the issue. A workaround is to use repr(sock._sock) to use repr(_socket.socket) which contains a lot of information. -- resolution: -> wont fix status: open -> closed _

[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7

2014-07-26 Thread Alex Gaynor
Alex Gaynor added the comment: Personally I don't think it is (or should) be against policy to change reprs, there's not really any way to improve them otherwise. That said, my excitement level about this issue is pretty low, so I won't argue more than this :-) -- ___

[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7

2014-07-26 Thread Guido van Rossum
Guido van Rossum added the comment: OK, I'm convinced. Sorry Victor. On Saturday, July 26, 2014, Serhiy Storchaka wrote: > > Serhiy Storchaka added the comment: > > See for example test_generators, test_genexps, test_xml_etree or > ctypes.test.test_objects. > > >>> dict(a = (i for i in xra

[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7

2014-07-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: See for example test_generators, test_genexps, test_xml_etree or ctypes.test.test_objects. >>> dict(a = (i for i in xrange(10))) #doctest: +ELLIPSIS {'a': at ...>} >>> repr(element) # doctest: +ELLIPSIS "" But unit tests can be broken too

[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7

2014-07-26 Thread Guido van Rossum
Guido van Rossum added the comment: I don't think it's against policy. Do doctests even work for objects that have an address as part of their repr()? -- ___ Python tracker ___

[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7

2014-07-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I afraid this can break doctests. Isn't this against policy? -- nosy: +serhiy.storchaka ___ Python tracker ___ ___

[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7

2014-07-26 Thread Guido van Rossum
Guido van Rossum added the comment: Antoine, what do you want me to do? I think improving __repr__ of a socket sounds fine for some Python 2.7 bugfix release. -- ___ Python tracker ___

[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7

2014-07-26 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- nosy: +gvanrossum ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7

2014-07-26 Thread STINNER Victor
STINNER Victor added the comment: I also fixed repr(_socket.socket) on Windows 64-bit for closed sockets (on Python 2.7, 3.4 and 3.5): changeset: 91881:04c916a1e82f branch: 2.7 tag: tip user:Victor Stinner date:Sat Jul 26 14:52:55 2014 +0200 files: Lib/test

[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7

2014-07-26 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +alex ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.

[issue22081] Backport repr(socket.socket) from Python 3.5 to Python 2.7

2014-07-26 Thread STINNER Victor
New submission from STINNER Victor: Currently, the C module _socket has an useful representation of socket: it gives the file descriptor, family, type, etc. The Python socket module only shows the memory address. Example: $ ./python -c 'import _socket; s=_socket.socket(); print(repr(s));' $