New submission from Rick van Rein <r...@openfortress.nl>:

Shown in the session below is unexpected output of a 4-tuple from an AF_INET6 
socket along with documentation that *suggests* to expect a 2-tuple.  The 
phrasing "IP" might have to be toned down to "IPv4" or "AF_INET" to be accurate 
enough to avoid confusion.

Opinion: I think you should be explicit about the different behaviour for 
AF_INET6, so it is not reduced to a special/nut case for special interest 
groups.  IPv6 has a hard enough time getting in; different formats for AF_INET 
and AF_INET6 should ideally be shown to all programmers, to at least avoid 
*uninformed* decisions to be incompatible with IPv6 while they develop on an 
IPv4 system (and the same in the opposite direction).


Python 3.7.3 (default, Jul 25 2020, 13:03:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> sox6 = socket.socket (socket.AF_INET6)
>>> sox6.getsockname ()
('::', 0, 0, 0)
>>> sox6.getsockname.__doc__
'getsockname() -> address info\n\nReturn the address of the local endpoint.  
For IP sockets, the address\ninfo is a pair (hostaddr, port).'

----------
components: Library (Lib)
messages: 382863
nosy: vanrein
priority: normal
severity: normal
status: open
title: documentation on `getsockname()` wrong for AF_INET6
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42620>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to