Antoine Pitrou added the comment:

Amusingly, binding to the empty string produces something different:

>>> s = socket.socket(socket.AF_UNIX)
>>> s.getsockname()
b''
>>> s.bind(b'')
>>> s.getsockname()
b'\x000005d'

while binding to the nul byte string produces the expected result:

>>> s = socket.socket(socket.AF_UNIX)
>>> s.bind(b'\x00')
>>> s.getsockname()
b'\x00'

----------
components: +Library (Lib)
nosy: +pitrou
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.5, Python 3.6, Python 3.7 -Python 2.7

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

Reply via email to